]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
unlink_directory(): Return ELOOP for unexpected symlinks also when O_NOFOLLOW isn...
authorTimo Sirainen <tss@iki.fi>
Thu, 30 Dec 2010 11:41:10 +0000 (13:41 +0200)
committerTimo Sirainen <tss@iki.fi>
Thu, 30 Dec 2010 11:41:10 +0000 (13:41 +0200)
src/lib/unlink-directory.c

index 89853e9898dde980ebe53975fe69023ce3df5238..0055d554bc7b8b5ba58aa298fcef2d73c44d9bca 100644 (file)
@@ -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;
        }