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)
73 return status; 73 return status;
74 } 74 }
75 75
76 if (rmdir(path) < 0) { 76 if (status == 0 && rmdir(path) < 0) {
77 bb_perror_msg("can't remove '%s'", path); 77 bb_perror_msg("can't remove '%s'", path);
78 return -1; 78 return -1;
79 } 79 }