diff options
author | Rob Landley <rob@landley.net> | 2014-07-03 18:42:44 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2014-07-03 18:42:44 -0500 |
commit | 5ce682e4f4b0c789d591afce1e053efd01313f2d (patch) | |
tree | 4273a0841986d1c6038bbdc14a7cd01e7f137525 /toys | |
parent | 9bf93edd68742bbc9e814ec49c8a3a31ca8d3fff (diff) | |
download | toybox-5ce682e4f4b0c789d591afce1e053efd01313f2d.tar.gz |
Fix rm -rf of chmod 000 directories.
Diffstat (limited to 'toys')
-rw-r--r-- | toys/posix/rm.c | 5 |
1 files changed, 5 insertions, 0 deletions
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; |