Skip to content

Commit

Permalink
fs-posix: Fix iterating nonexistent symlinks when readdir() returns D…
Browse files Browse the repository at this point in the history
…T_UNKNOWN

This especially broke "doveadm fs delete -R" when the symlink destination
was deleted before the symlink.
  • Loading branch information
sirainen committed Apr 30, 2018
1 parent e58cc80 commit 09496e5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib-fs/fs-posix.c
Expand Up @@ -827,7 +827,8 @@ static bool fs_posix_iter_want(struct posix_fs_iter *iter, const char *fname)
const char *path = t_strdup_printf("%s/%s", iter->path, fname);
struct stat st;

if (stat(path, &st) < 0)
if (stat(path, &st) < 0 &&
lstat(path, &st) < 0)
ret = FALSE;
else if (!S_ISDIR(st.st_mode))
ret = (iter->iter.flags & FS_ITER_FLAG_DIRS) == 0;
Expand Down

0 comments on commit 09496e5

Please sign in to comment.