summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2014-08-08 13:17:50 -0700
committerRussell Belfer <rb@github.com>2014-08-08 13:17:50 -0700
commitf18234fad62b8f890ccd01bb15443afc2484af1b (patch)
treedc79accc50fc391fbbca3001df0538d19ffc01fa /src
parent8f759ac0b373eea9dcec680524a68a527d637937 (diff)
downloadlibgit2-f18234fad62b8f890ccd01bb15443afc2484af1b.tar.gz
Don't report status on named pipes
Git skips entries in directories that are not S_ISDIR, S_ISREG, or S_ISLNK, so let's make libgit2 do the same thing.
Diffstat (limited to 'src')
-rw-r--r--src/path.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/path.c b/src/path.c
index 4837b01f9..77f8d8858 100644
--- a/src/path.c
+++ b/src/path.c
@@ -1110,28 +1110,29 @@ int git_path_dirload_with_stat(
if ((error = git_buf_joinpath(&full, full.ptr, ps->path)) < 0 ||
(error = git_path_lstat(full.ptr, &ps->st)) < 0) {
+
if (error == GIT_ENOTFOUND) {
- giterr_clear();
- error = 0;
+ /* file was removed between readdir and lstat */
git_vector_remove(contents, i--);
- continue;
- }
- /* Treat the file as unreadable if we get any other error */
- if (error != 0) {
- giterr_clear();
- error = 0;
+ } else {
+ /* Treat the file as unreadable if we get any other error */
memset(&ps->st, 0, sizeof(ps->st));
ps->st.st_mode = GIT_FILEMODE_UNREADABLE;
- continue;
}
-
- break;
+
+ giterr_clear();
+ error = 0;
+ continue;
}
if (S_ISDIR(ps->st.st_mode)) {
ps->path[ps->path_len++] = '/';
ps->path[ps->path_len] = '\0';
}
+ else if (!S_ISREG(ps->st.st_mode) && !S_ISLNK(ps->st.st_mode)) {
+ /* skip everything but dirs, plain files, and symlinks */
+ git_vector_remove(contents, i--);
+ }
}
/* sort now that directory suffix is added */