diff options
Diffstat (limited to 'dir-iterator.c')
-rw-r--r-- | dir-iterator.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/dir-iterator.c b/dir-iterator.c index 3764dd81a1..fb7c47f0e8 100644 --- a/dir-iterator.c +++ b/dir-iterator.c @@ -1,4 +1,5 @@ -#include "cache.h" +#include "git-compat-util.h" +#include "alloc.h" #include "dir.h" #include "iterator.h" #include "dir-iterator.h" @@ -112,10 +113,7 @@ static int prepare_next_entry_data(struct dir_iterator_int *iter, iter->base.basename = iter->base.path.buf + iter->levels[iter->levels_nr - 1].prefix_len; - if (iter->flags & DIR_ITERATOR_FOLLOW_SYMLINKS) - err = stat(iter->base.path.buf, &iter->base.st); - else - err = lstat(iter->base.path.buf, &iter->base.st); + err = lstat(iter->base.path.buf, &iter->base.st); saved_errno = errno; if (err && errno != ENOENT) @@ -213,13 +211,10 @@ struct dir_iterator *dir_iterator_begin(const char *path, unsigned int flags) iter->flags = flags; /* - * Note: stat/lstat already checks for NULL or empty strings and + * Note: lstat already checks for NULL or empty strings and * nonexistent paths. */ - if (iter->flags & DIR_ITERATOR_FOLLOW_SYMLINKS) - err = stat(iter->base.path.buf, &iter->base.st); - else - err = lstat(iter->base.path.buf, &iter->base.st); + err = lstat(iter->base.path.buf, &iter->base.st); if (err < 0) { saved_errno = errno; |