changeset 1674:39b5bc4e1853 draft

In rm, init using to AT_REMOVEDIR in the dir case earlier. (If you had a chmod 000 directory and did rm -r on it without -f, after the prompt it would complain it was a directory.)
author Rob Landley <rob@landley.net>
date Fri, 06 Feb 2015 17:31:52 -0600
parents 6b494fdd61e0
children 435f91d71898
files toys/posix/rm.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/toys/posix/rm.c	Fri Feb 06 16:42:44 2015 -0600
+++ b/toys/posix/rm.c	Fri Feb 06 17:31:52 2015 -0600
@@ -47,13 +47,13 @@
 
   // handle directory recursion
   if (dir) {
+    using = AT_REMOVEDIR;
     // Handle chmod 000 directories when -f
     if (faccessat(fd, try->name, R_OK, 0)) {
       if (toys.optflags & FLAG_f) wfchmodat(fd, try->name, 0700);
       else goto skip;
     }
     if (!try->again) return DIRTREE_COMEAGAIN;
-    using = AT_REMOVEDIR;
     if (try->symlink) goto skip;
     if (flags & FLAG_i) {
       char *s = dirtree_path(try, 0);