configure.ac: loosen FREAD_READS_DIRECTORIES test program
[gitweb.git] / dir.c
diff --git a/dir.c b/dir.c
index f451bfa48c0a0e7905d4c2adf4e3e05a8d272a8a..be616e884e8dbbebe95d361267b12212bce2fd9d 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -745,9 +745,9 @@ static int add_excludes(const char *fname, const char *base, int baselen,
 
        fd = open(fname, O_RDONLY);
        if (fd < 0 || fstat(fd, &st) < 0) {
-               if (errno != ENOENT)
-                       warn_on_inaccessible(fname);
-               if (0 <= fd)
+               if (fd < 0)
+                       warn_on_fopen_errors(fname);
+               else
                        close(fd);
                if (!check_index ||
                    (buf = read_skip_worktree_file_from_index(fname, &size, sha1_stat)) == NULL)