summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjetil Barvik <barvik@broadpark.no>2009-02-09 20:54:52 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-02-10 04:59:26 (GMT)
commit91fcbcbdcdd845bd43104c5ac0af4c40da15223b (patch)
treedb79289bc0d20fa422969bd2ca93220427e78b7d
parente4c7292353dbef39feac1c6a60c5cde9140520a6 (diff)
downloadgit-91fcbcbdcdd845bd43104c5ac0af4c40da15223b.zip
git-91fcbcbdcdd845bd43104c5ac0af4c40da15223b.tar.gz
git-91fcbcbdcdd845bd43104c5ac0af4c40da15223b.tar.bz2
show_patch_diff(): remove a call to fstat()
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--combine-diff.c4
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;