aboutsummaryrefslogtreecommitdiff
path: root/lib/dirtree.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dirtree.c')
-rw-r--r--lib/dirtree.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/dirtree.c b/lib/dirtree.c
index beaafd59..9917a815 100644
--- a/lib/dirtree.c
+++ b/lib/dirtree.c
@@ -38,9 +38,8 @@ struct dirtree *dirtree_add_node(struct dirtree *parent, char *name, int flags)
// stat dangling symlinks
if (fstatat(fd, name, &st, sym)) {
- if (errno != ENOENT
- || (!sym && fstatat(fd, name, &st, AT_SYMLINK_NOFOLLOW)))
- {
+ // If we got ENOENT without NOFOLLOW, try again with NOFOLLOW.
+ if (errno!=ENOENT || sym || fstatat(fd, name, &st, AT_SYMLINK_NOFOLLOW)) {
if (flags&DIRTREE_STATLESS) statless++;
else goto error;
}