From: Timo Sirainen Date: Thu, 30 Dec 2010 11:41:10 +0000 (+0200) Subject: unlink_directory(): Return ELOOP for unexpected symlinks also when O_NOFOLLOW isn... X-Git-Tag: 2.0.9~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2c8041ef37c9bf07344bdf2a162c0ac96647bf8b;p=thirdparty%2Fdovecot%2Fcore.git unlink_directory(): Return ELOOP for unexpected symlinks also when O_NOFOLLOW isn't supported. --- diff --git a/src/lib/unlink-directory.c b/src/lib/unlink-directory.c index 89853e9898..0055d554bc 100644 --- a/src/lib/unlink-directory.c +++ b/src/lib/unlink-directory.c @@ -59,7 +59,12 @@ static int unlink_directory_r(const char *dir) return -1; if (!S_ISDIR(st.st_mode)) { - errno = ENOTDIR; + if ((st.st_mode & S_IFMT) != S_IFLNK) + errno = ENOTDIR; + else { + /* be compatible with O_NOFOLLOW */ + errno = ELOOP; + } return -1; }