aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/rm.c
diff options
context:
space:
mode:
authorDenys Nykula <nykula@ukr.net>2019-11-12 16:55:35 +0000
committerRob Landley <rob@landley.net>2019-11-12 19:50:51 -0600
commitae34569fd0e2242ea85ffec193d825dd006d1038 (patch)
tree1361867a8451b6f793514b6deb1b994ada051468 /toys/posix/rm.c
parentdf6aaa39fbf7baa82e27e7eb83673629284966d0 (diff)
downloadtoybox-ae34569fd0e2242ea85ffec193d825dd006d1038.tar.gz
Don't rm prompt for nonexistent, just warn.
Diffstat (limited to 'toys/posix/rm.c')
-rw-r--r--toys/posix/rm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/toys/posix/rm.c b/toys/posix/rm.c
index 8874b54f..2a6bc282 100644
--- a/toys/posix/rm.c
+++ b/toys/posix/rm.c
@@ -37,6 +37,10 @@ static int do_rm(struct dirtree *try)
// This is either the posix section 2(b) prompt or the section 3 prompt.
if (!FLAG(f)
&& (!S_ISLNK(try->st.st_mode) && faccessat(fd, try->name, W_OK, 0))) or++;
+
+ // Posix section 1(a), don't prompt for nonexistent.
+ if (or && errno == ENOENT) goto skip;
+
if (!(dir && try->again) && ((or && isatty(0)) || FLAG(i))) {
char *s = dirtree_path(try, 0);