[PATCH/RFC v3 8/9] show_patch_diff(): remove a call to fstat()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Kjetil Barvik
Date: Wednesday, February 4, 2009 - 5:53 am

Currently inside show_patch_diff() we have an fstat() call after an
ok lstat() call.  Since before the call to fstat() we have already
tested for the link case with S_ISLNK(), the fstat() can be removed.

Signed-off-by: Kjetil Barvik <barvik@broadpark.no>
---
 combine-diff.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/combine-diff.c b/combine-diff.c
index bccc018..4300319 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -713,9 +713,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
 			result_size = buf.len;
 			result = strbuf_detach(&buf, NULL);
 			elem->mode = canon_mode(st.st_mode);
-		}
-		else if (0 <= (fd = open(elem->path, O_RDONLY)) &&
-			 !fstat(fd, &st)) {
+		} else if (0 <= (fd = open(elem->path, O_RDONLY))) {
 			size_t len = xsize_t(st.st_size);
 			ssize_t done;
 			int is_file, i;
-- 
1.6.1.349.g99fa5

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH/RFC v3 8/9] show_patch_diff(): remove a call to fstat(), Kjetil Barvik, (Wed Feb 4, 5:53 am)
Re: [PATCH/RFC v3 7/9] write_entry(): use fstat() instead ..., Johannes Schindelin, (Thu Feb 5, 4:03 am)
Re: [PATCH/RFC v3 7/9] write_entry(): use fstat() instead ..., Johannes Schindelin, (Fri Feb 6, 4:26 am)