close
Skip to content

Commit 848222c

Browse files
committed
fixup! dir.c: regression fix for add_excludes with fscache
It is unlikely that the fstat() call fails, but not impossible... Coverity pointed out that we check for its return value elsewhere, so we might just as well do it here, too. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 0d68a45 commit 848222c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎dir.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,8 +788,10 @@ static int add_excludes(const char *fname, const char *base, int baselen,
788788
fd = open(fname, O_RDONLY);
789789
if (fd < 0)
790790
warn_on_fopen_errors(fname);
791-
if (S_ISLNK(st.st_mode))
792-
fstat(fd, &st);
791+
if (S_ISLNK(st.st_mode) && fstat(fd, &st) < 0) {
792+
warn_on_fopen_errors(fname);
793+
fd = -1;
794+
}
793795
}
794796
} else {
795797
fd = open(fname, O_RDONLY);

0 commit comments

Comments
 (0)