Under the description for the -f option, POSIX says, "Do not modify the exit status in the case of nonexistent operands". ---
Whoops, just realized that simply using the errno from the remove call is way simpler. libutil/rm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libutil/rm.c b/libutil/rm.c index 53ae3f2..54987e5 100644 --- a/libutil/rm.c +++ b/libutil/rm.c @@ -1,4 +1,5 @@ /* See LICENSE file for copyright and license details. */ +#include <errno.h> #include <stdio.h> #include "../fs.h" @@ -14,8 +15,9 @@ rm(const char *path, int unused) if (rm_rflag) recurse(path, rm, 'P'); if (remove(path) < 0) { + if (!rm_fflag || errno != ENOENT) + rm_status = 1; if (!rm_fflag) weprintf("remove %s:", path); - rm_status = 1; } } -- 2.1.3.1.g339ec9c