toolbox: Fix rm -f with multiple files
Only check errno if unlink returns -1.
Continue instead of exiting if one file does not exist.
Change-Id: Iaf01b8523b84e87fcb0d732b89b7be6e24279c0b
diff --git a/toolbox/rm.c b/toolbox/rm.c
index 3a24bec..127cbc4 100644
--- a/toolbox/rm.c
+++ b/toolbox/rm.c
@@ -103,8 +103,8 @@
ret = unlink_recursive(argv[i], flags);
} else {
ret = unlink(argv[i]);
- if (errno == ENOENT && (flags & OPT_FORCE)) {
- return 0;
+ if (ret < 0 && errno == ENOENT && (flags & OPT_FORCE)) {
+ continue;
}
}