changeset 12571:c67f4a2a2253

unlink_directory(): Return ELOOP for unexpected symlinks also when O_NOFOLLOW isn't supported.
author Timo Sirainen <tss@iki.fi>
date Thu, 30 Dec 2010 13:41:10 +0200
parents a293626e09e2
children b78e772cf1d2
files src/lib/unlink-directory.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/unlink-directory.c	Thu Dec 30 12:45:52 2010 +0200
+++ b/src/lib/unlink-directory.c	Thu Dec 30 13:41:10 2010 +0200
@@ -59,7 +59,12 @@
 		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;
 	}