From: Timo Sirainen Date: Thu, 29 Mar 2018 18:24:11 +0000 (-0400) Subject: fs-posix: Fix iterating nonexistent symlinks when readdir() returns DT_UNKNOWN X-Git-Tag: 2.3.2.rc1~122 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=08e32bfc8019021a3b16fb5db95f75d1eec6ff31;p=thirdparty%2Fdovecot%2Fcore.git fs-posix: Fix iterating nonexistent symlinks when readdir() returns DT_UNKNOWN This especially broke "doveadm fs delete -R" when the symlink destination was deleted before the symlink. --- diff --git a/src/lib-fs/fs-posix.c b/src/lib-fs/fs-posix.c index efd2afe260..08e733dd1c 100644 --- a/src/lib-fs/fs-posix.c +++ b/src/lib-fs/fs-posix.c @@ -829,7 +829,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;