aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbb/remove_file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libbb/remove_file.c b/libbb/remove_file.c
index 86c9a5c56..cea5d47e6 100644
--- a/libbb/remove_file.c
+++ b/libbb/remove_file.c
@@ -73,7 +73,7 @@ int FAST_FUNC remove_file(const char *path, int flags)
return status;
}
- if (rmdir(path) < 0) {
+ if (status == 0 && rmdir(path) < 0) {
bb_perror_msg("can't remove '%s'", path);
return -1;
}