X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=rm.c;h=a9501ec7f004c23277b5c913c0657c5f1c8da1d2;hb=46f44d24fcc25a5d6e13e0453485881bdf147e91;hp=c62083e9b940603088af0b7ea0e2efa46e62b687;hpb=3e856ce428cabaf6c8d99a2374a1f9a4a05db5f0;p=oweals%2Fbusybox.git diff --git a/rm.c b/rm.c index c62083e9b..a9501ec7f 100644 --- a/rm.c +++ b/rm.c @@ -37,7 +37,7 @@ static const char *srcName; static int fileAction(const char *fileName, struct stat *statbuf, void* junk) { if (unlink(fileName) < 0) { - perror(fileName); + perror_msg("%s", fileName); return (FALSE); } return (TRUE); @@ -47,11 +47,11 @@ static int dirAction(const char *fileName, struct stat *statbuf, void* junk) { if (recursiveFlag == FALSE) { errno = EISDIR; - perror(fileName); + perror_msg("%s", fileName); return (FALSE); } if (rmdir(fileName) < 0) { - perror(fileName); + perror_msg("%s", fileName); return (FALSE); } return (TRUE); @@ -59,6 +59,7 @@ static int dirAction(const char *fileName, struct stat *statbuf, void* junk) extern int rm_main(int argc, char **argv) { + int status = EXIT_SUCCESS; int stopIt=FALSE; struct stat statbuf; @@ -100,11 +101,11 @@ extern int rm_main(int argc, char **argv) && errno == ENOENT) { /* do not reports errors for non-existent files if -f, just skip them */ } else { - if (recursiveAction(srcName, recursiveFlag, FALSE, + if (recursive_action(srcName, recursiveFlag, FALSE, TRUE, fileAction, dirAction, NULL) == FALSE) { - return EXIT_FAILURE; + status = EXIT_FAILURE; } } } - return EXIT_SUCCESS; + return status; }