aboutsummaryrefslogtreecommitdiff
path: root/rm.c
diff options
context:
space:
mode:
authorkraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-12-05 05:11:41 +0000
committerkraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-12-05 05:11:41 +0000
commit9ae0be95f1e349f0586a8bc7a4f6d0433c6a4baf (patch)
tree1ecefa6dc73279cfe4ae3a45cc647823094248f0 /rm.c
parentd18a6dc095293935291da09ffd14c8bd551b99cf (diff)
downloadbusybox-w32-9ae0be95f1e349f0586a8bc7a4f6d0433c6a4baf.tar.gz
busybox-w32-9ae0be95f1e349f0586a8bc7a4f6d0433c6a4baf.tar.bz2
busybox-w32-9ae0be95f1e349f0586a8bc7a4f6d0433c6a4baf.zip
Use perrorMsg instead of perror and keep removing files if we encounter
an error. git-svn-id: svn://busybox.net/trunk/busybox@1377 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'rm.c')
-rw-r--r--rm.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/rm.c b/rm.c
index c62083e9b..566335158 100644
--- a/rm.c
+++ b/rm.c
@@ -37,7 +37,7 @@ static const char *srcName;
37static int fileAction(const char *fileName, struct stat *statbuf, void* junk) 37static 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
60extern int rm_main(int argc, char **argv) 60extern 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}