[PATCH 02/19] fs: fix rmdir with symlink

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Tue Sep 4 15:50:00 EDT 2012


Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
 fs/fs.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/fs.c b/fs/fs.c
index 6a85513..914df5a 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1253,6 +1253,12 @@ int rmdir (const char *pathname)
 	char *freep = p;
 	int ret;
 
+	ret = path_check_prereq(pathname, S_IFLNK);
+	if (!ret) {
+		ret = -ENOTDIR;
+		goto out;
+	}
+
 	ret = path_check_prereq(pathname, S_IFDIR | S_UB_IS_EMPTY);
 	if (ret)
 		goto out;
-- 
1.7.10.4




More information about the barebox mailing list