aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2021-03-20 00:09:51 -0500
committerRob Landley <rob@landley.net>2021-03-20 00:09:51 -0500
commit855eca3eaf8ea849599662900a3de18f6ebab9ef (patch)
treebc925fd31fa0e54c7b94d607e6bcc95bc8e9259e /toys/posix
parent3aaf63f6d908eea164111791ec90fd608000dfe1 (diff)
downloadtoybox-855eca3eaf8ea849599662900a3de18f6ebab9ef.tar.gz
Nir Lichtman pointed out that rm -p shouldn't try to rmdir / at the end.
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/rmdir.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/toys/posix/rmdir.c b/toys/posix/rmdir.c
index c25fd839..3714f334 100644
--- a/toys/posix/rmdir.c
+++ b/toys/posix/rmdir.c
@@ -25,7 +25,7 @@ static void do_rmdir(char *name)
{
char *temp;
- for (;;) {
+ do {
if (rmdir(name)) {
if (!FLAG(ignore_fail_on_non_empty) || errno != ENOTEMPTY)
perror_msg_raw(name);
@@ -39,7 +39,7 @@ static void do_rmdir(char *name)
if (!(temp = strrchr(name, '/'))) return;
*temp = 0;
} while (!temp[1]);
- }
+ } while (*name);
}
void rmdir_main(void)