зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
e4c7292353
Коммит
91fcbcbdcd
|
@ -713,9 +713,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
||||||
result_size = buf.len;
|
result_size = buf.len;
|
||||||
result = strbuf_detach(&buf, NULL);
|
result = strbuf_detach(&buf, NULL);
|
||||||
elem->mode = canon_mode(st.st_mode);
|
elem->mode = canon_mode(st.st_mode);
|
||||||
}
|
} else if (0 <= (fd = open(elem->path, O_RDONLY))) {
|
||||||
else if (0 <= (fd = open(elem->path, O_RDONLY)) &&
|
|
||||||
!fstat(fd, &st)) {
|
|
||||||
size_t len = xsize_t(st.st_size);
|
size_t len = xsize_t(st.st_size);
|
||||||
ssize_t done;
|
ssize_t done;
|
||||||
int is_file, i;
|
int is_file, i;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче