Skip to content
Permalink
Browse files

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>
  • Loading branch information...
dscho committed Dec 21, 2017
1 parent 0d68a45 commit 848222cb91bb2dd5c1dcb6e4d4abc3c6e5c033af
Showing with 4 additions and 2 deletions.
  1. +4 −2 dir.c
6 dir.c
@@ -788,8 +788,10 @@ static int add_excludes(const char *fname, const char *base, int baselen,
fd = open(fname, O_RDONLY);
if (fd < 0)
warn_on_fopen_errors(fname);
if (S_ISLNK(st.st_mode))
fstat(fd, &st);
if (S_ISLNK(st.st_mode) && fstat(fd, &st) < 0) {
warn_on_fopen_errors(fname);
fd = -1;
}
}
} else {
fd = open(fname, O_RDONLY);

0 comments on commit 848222c

Please sign in to comment.
You can’t perform that action at this time.