From 5ce682e4f4b0c789d591afce1e053efd01313f2d Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 3 Jul 2014 18:42:44 -0500 Subject: Fix rm -rf of chmod 000 directories. --- toys/posix/rm.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'toys/posix') diff --git a/toys/posix/rm.c b/toys/posix/rm.c index 19579db3..15359cb1 100644 --- a/toys/posix/rm.c +++ b/toys/posix/rm.c @@ -47,6 +47,11 @@ static int do_rm(struct dirtree *try) // handle directory recursion if (dir) { + // Handle chmod 000 directories when -f + if (faccessat(fd, try->name, R_OK, AT_SYMLINK_NOFOLLOW)) { + if (toys.optflags & FLAG_f) wfchmodat(fd, try->name, 0600); + else goto skip; + } if (try->data != -1) return DIRTREE_COMEAGAIN; using = AT_REMOVEDIR; if (try->symlink) goto skip; -- cgit v1.2.3