diff options
Diffstat (limited to 'toys/posix')
-rw-r--r-- | toys/posix/rmdir.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/toys/posix/rmdir.c b/toys/posix/rmdir.c index 90920ef6..d04cf0d9 100644 --- a/toys/posix/rmdir.c +++ b/toys/posix/rmdir.c @@ -4,7 +4,7 @@ * * See http://opengroup.org/onlinepubs/9699919799/utilities/rmdir.html -USE_RMDIR(NEWTOY(rmdir, "<1p", TOYFLAG_BIN)) +USE_RMDIR(NEWTOY(rmdir, "<1(ignore-fail-on-non-empty)p", TOYFLAG_BIN)) config RMDIR bool "rmdir" @@ -15,8 +15,10 @@ config RMDIR Remove one or more directories. -p Remove path + --ignore-fail-on-non-empty Ignore failures caused by non-empty directories */ +#define FOR_rmdir #include "toys.h" static void do_rmdir(char *name) @@ -25,7 +27,8 @@ static void do_rmdir(char *name) for (;;) { if (rmdir(name)) { - perror_msg_raw(name); + if (!FLAG(ignore_fail_on_non_empty) || errno != ENOTEMPTY) + perror_msg_raw(name); return; } |