diff options
-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; |