# HG changeset patch # User Rob Landley # Date 1404430964 18000 # Node ID 739d3fc60f4872f21929f79bdb486b395ae039d2 # Parent a3ee4f91462adc3251084f755fe9a67d25eb300a Fix rm -rf of chmod 000 directories. diff -r a3ee4f91462a -r 739d3fc60f48 toys/posix/rm.c --- a/toys/posix/rm.c Mon Jun 30 05:05:39 2014 -0500 +++ b/toys/posix/rm.c Thu Jul 03 18:42:44 2014 -0500 @@ -47,6 +47,11 @@ // 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;