aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/rm.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-07-26 13:30:40 -0500
committerRob Landley <rob@landley.net>2014-07-26 13:30:40 -0500
commitfec3fd1f8ac1db9ed87b79bd3eb5e38aa835e881 (patch)
treea7e149cf0fefef5d252706797fff8c831ebb0460 /toys/posix/rm.c
parentccb73f8bf9191c01c90975958a210c47175bd98c (diff)
downloadtoybox-fec3fd1f8ac1db9ed87b79bd3eb5e38aa835e881.tar.gz
Move DIRTREE_COMEAGAIN second callback up to when the filehandle is still open, and add dir->again variable to distinguish second call instead of checking for -1 filehandle.
Diffstat (limited to 'toys/posix/rm.c')
-rw-r--r--toys/posix/rm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/toys/posix/rm.c b/toys/posix/rm.c
index 15359cb1..2f40106f 100644
--- a/toys/posix/rm.c
+++ b/toys/posix/rm.c
@@ -37,7 +37,7 @@ static int do_rm(struct dirtree *try)
// This is either the posix section 2(b) prompt or the section 3 prompt.
if (!(flags & FLAG_f)
&& (!S_ISLNK(try->st.st_mode) && faccessat(fd, try->name, W_OK, 0))) or++;
- if (!(dir && try->data == -1) && ((or && isatty(0)) || (flags & FLAG_i))) {
+ if (!(dir && try->again) && ((or && isatty(0)) || (flags & FLAG_i))) {
char *s = dirtree_path(try, 0);
fprintf(stderr, "rm %s%s", or ? "ro " : "", dir ? "dir " : "");
or = yesno(s, 0);
@@ -52,7 +52,7 @@ static int do_rm(struct dirtree *try)
if (toys.optflags & FLAG_f) wfchmodat(fd, try->name, 0600);
else goto skip;
}
- if (try->data != -1) return DIRTREE_COMEAGAIN;
+ if (!try->again) return DIRTREE_COMEAGAIN;
using = AT_REMOVEDIR;
if (try->symlink) goto skip;
if (flags & FLAG_i) {