From: Kjetil Barvik Date: Mon, 26 Jan 2009 21:17:16 GMT Subject: [PATCH/RFC v1 5/6] combine-diff.c: remove a call to fstat() inside show_patch_diff() Message-ID: <1233004637-15112-6-git-send-email-barvik@broadpark.no> In-Reply-To: <1233004637-15112-1-git-send-email-barvik@broadpark.no> Currently inside show_patch_diff() we have and fstat() call after an ok lstat() call. Since we before the call to fstat() have already test for the link case with S_ISLNK() the fstat() can be removed. Signed-off-by: Kjetil Barvik --- combine-diff.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/combine-diff.c b/combine-diff.c index bccc018..ab4df31 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -713,9 +713,8 @@ 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