@matheusbsbs / matheus-bagliano / commits / 91fcbcbdcd
Fork 0

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>

Kjetil Barvik committed Feb 9, 2009 at 21:54 UTC 91fcbcbdcdd845bd43104c5ac0af4c40da15223b
1 file changed +1 -3
combine-diff.c
+1 -3
@@ -713,9 +713,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
713 result_size = buf.len;
714 result = strbuf_detach(&buf, NULL);
715 elem->mode = canon_mode(st.st_mode);
716 - }
717 - else if (0 <= (fd = open(elem->path, O_RDONLY)) &&
718 - !fstat(fd, &st)) {
716 + } else if (0 <= (fd = open(elem->path, O_RDONLY))) {
717 size_t len = xsize_t(st.st_size);
718 ssize_t done;
719 int is_file, i;