diff options
Diffstat (limited to 'rm.c')
-rw-r--r-- | rm.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -37,7 +37,7 @@ static const char *srcName; | |||
37 | static int fileAction(const char *fileName, struct stat *statbuf, void* junk) | 37 | static int fileAction(const char *fileName, struct stat *statbuf, void* junk) |
38 | { | 38 | { |
39 | if (unlink(fileName) < 0) { | 39 | if (unlink(fileName) < 0) { |
40 | perror(fileName); | 40 | perrorMsg("%s", fileName); |
41 | return (FALSE); | 41 | return (FALSE); |
42 | } | 42 | } |
43 | return (TRUE); | 43 | return (TRUE); |
@@ -47,11 +47,11 @@ static int dirAction(const char *fileName, struct stat *statbuf, void* junk) | |||
47 | { | 47 | { |
48 | if (recursiveFlag == FALSE) { | 48 | if (recursiveFlag == FALSE) { |
49 | errno = EISDIR; | 49 | errno = EISDIR; |
50 | perror(fileName); | 50 | perrorMsg("%s", fileName); |
51 | return (FALSE); | 51 | return (FALSE); |
52 | } | 52 | } |
53 | if (rmdir(fileName) < 0) { | 53 | if (rmdir(fileName) < 0) { |
54 | perror(fileName); | 54 | perrorMsg("%s", fileName); |
55 | return (FALSE); | 55 | return (FALSE); |
56 | } | 56 | } |
57 | return (TRUE); | 57 | return (TRUE); |
@@ -59,6 +59,7 @@ static int dirAction(const char *fileName, struct stat *statbuf, void* junk) | |||
59 | 59 | ||
60 | extern int rm_main(int argc, char **argv) | 60 | extern int rm_main(int argc, char **argv) |
61 | { | 61 | { |
62 | int status = EXIT_SUCCESS; | ||
62 | int stopIt=FALSE; | 63 | int stopIt=FALSE; |
63 | struct stat statbuf; | 64 | struct stat statbuf; |
64 | 65 | ||
@@ -102,9 +103,9 @@ extern int rm_main(int argc, char **argv) | |||
102 | } else { | 103 | } else { |
103 | if (recursiveAction(srcName, recursiveFlag, FALSE, | 104 | if (recursiveAction(srcName, recursiveFlag, FALSE, |
104 | TRUE, fileAction, dirAction, NULL) == FALSE) { | 105 | TRUE, fileAction, dirAction, NULL) == FALSE) { |
105 | return EXIT_FAILURE; | 106 | status = EXIT_FAILURE; |
106 | } | 107 | } |
107 | } | 108 | } |
108 | } | 109 | } |
109 | return EXIT_SUCCESS; | 110 | return status; |
110 | } | 111 | } |