aboutsummaryrefslogtreecommitdiff
path: root/libbb/remove_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/remove_file.c')
-rw-r--r--libbb/remove_file.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/libbb/remove_file.c b/libbb/remove_file.c
index 988b09124..65708a252 100644
--- a/libbb/remove_file.c
+++ b/libbb/remove_file.c
@@ -37,7 +37,7 @@ extern int remove_file(const char *path, int flags)
37 37
38 if (lstat(path, &path_stat) < 0) { 38 if (lstat(path, &path_stat) < 0) {
39 if (errno != ENOENT) { 39 if (errno != ENOENT) {
40 perror_msg("unable to stat `%s'", path); 40 bb_perror_msg("unable to stat `%s'", path);
41 return -1; 41 return -1;
42 } 42 }
43 43
@@ -46,7 +46,7 @@ extern int remove_file(const char *path, int flags)
46 46
47 if (!path_exists) { 47 if (!path_exists) {
48 if (!(flags & FILEUTILS_FORCE)) { 48 if (!(flags & FILEUTILS_FORCE)) {
49 perror_msg("cannot remove `%s'", path); 49 bb_perror_msg("cannot remove `%s'", path);
50 return -1; 50 return -1;
51 } 51 }
52 return 0; 52 return 0;
@@ -58,21 +58,21 @@ extern int remove_file(const char *path, int flags)
58 int status = 0; 58 int status = 0;
59 59
60 if (!(flags & FILEUTILS_RECUR)) { 60 if (!(flags & FILEUTILS_RECUR)) {
61 error_msg("%s: is a directory", path); 61 bb_error_msg("%s: is a directory", path);
62 return -1; 62 return -1;
63 } 63 }
64 64
65 if ((!(flags & FILEUTILS_FORCE) && access(path, W_OK) < 0 && 65 if ((!(flags & FILEUTILS_FORCE) && access(path, W_OK) < 0 &&
66 isatty(0)) || 66 isatty(0)) ||
67 (flags & FILEUTILS_INTERACTIVE)) { 67 (flags & FILEUTILS_INTERACTIVE)) {
68 fprintf(stderr, "%s: descend into directory `%s'? ", applet_name, 68 fprintf(stderr, "%s: descend into directory `%s'? ", bb_applet_name,
69 path); 69 path);
70 if (!ask_confirmation()) 70 if (!bb_ask_confirmation())
71 return 0; 71 return 0;
72 } 72 }
73 73
74 if ((dp = opendir(path)) == NULL) { 74 if ((dp = opendir(path)) == NULL) {
75 perror_msg("unable to open `%s'", path); 75 bb_perror_msg("unable to open `%s'", path);
76 return -1; 76 return -1;
77 } 77 }
78 78
@@ -90,18 +90,18 @@ extern int remove_file(const char *path, int flags)
90 } 90 }
91 91
92 if (closedir(dp) < 0) { 92 if (closedir(dp) < 0) {
93 perror_msg("unable to close `%s'", path); 93 bb_perror_msg("unable to close `%s'", path);
94 return -1; 94 return -1;
95 } 95 }
96 96
97 if (flags & FILEUTILS_INTERACTIVE) { 97 if (flags & FILEUTILS_INTERACTIVE) {
98 fprintf(stderr, "%s: remove directory `%s'? ", applet_name, path); 98 fprintf(stderr, "%s: remove directory `%s'? ", bb_applet_name, path);
99 if (!ask_confirmation()) 99 if (!bb_ask_confirmation())
100 return status; 100 return status;
101 } 101 }
102 102
103 if (rmdir(path) < 0) { 103 if (rmdir(path) < 0) {
104 perror_msg("unable to remove `%s'", path); 104 bb_perror_msg("unable to remove `%s'", path);
105 return -1; 105 return -1;
106 } 106 }
107 107
@@ -111,13 +111,13 @@ extern int remove_file(const char *path, int flags)
111 !S_ISLNK(path_stat.st_mode) && 111 !S_ISLNK(path_stat.st_mode) &&
112 isatty(0)) || 112 isatty(0)) ||
113 (flags & FILEUTILS_INTERACTIVE)) { 113 (flags & FILEUTILS_INTERACTIVE)) {
114 fprintf(stderr, "%s: remove `%s'? ", applet_name, path); 114 fprintf(stderr, "%s: remove `%s'? ", bb_applet_name, path);
115 if (!ask_confirmation()) 115 if (!bb_ask_confirmation())
116 return 0; 116 return 0;
117 } 117 }
118 118
119 if (unlink(path) < 0) { 119 if (unlink(path) < 0) {
120 perror_msg("unable to remove `%s'", path); 120 bb_perror_msg("unable to remove `%s'", path);
121 return -1; 121 return -1;
122 } 122 }
123 123