diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-10-01 11:58:38 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-10-01 11:58:38 +0000 |
commit | 0c97c9d43707da745fe2bc62ab2a69497ceaf666 (patch) | |
tree | 267d0feb99f457b68c09315b3f3aebe8dfd6d411 | |
parent | d65ea39ffc7503807fa95e8840c012a80c83e4f3 (diff) | |
download | busybox-w32-0c97c9d43707da745fe2bc62ab2a69497ceaf666.tar.gz busybox-w32-0c97c9d43707da745fe2bc62ab2a69497ceaf666.tar.bz2 busybox-w32-0c97c9d43707da745fe2bc62ab2a69497ceaf666.zip |
'simple' error message functions by Loic Grenie <loic.grenie@gmail.com>.
263 bytes saved.
50 files changed, 73 insertions, 62 deletions
diff --git a/applets/applets.c b/applets/applets.c index 5b7b88a54..f91884b13 100644 --- a/applets/applets.c +++ b/applets/applets.c | |||
@@ -526,7 +526,7 @@ static void install_links(const char *busybox, int use_symbolic_links) | |||
526 | applets[i].name); | 526 | applets[i].name); |
527 | rc = lf(busybox, fpc); | 527 | rc = lf(busybox, fpc); |
528 | if (rc != 0 && errno != EEXIST) { | 528 | if (rc != 0 && errno != EEXIST) { |
529 | bb_perror_msg("%s", fpc); | 529 | bb_simple_perror_msg(fpc); |
530 | } | 530 | } |
531 | free(fpc); | 531 | free(fpc); |
532 | } | 532 | } |
diff --git a/archival/bbunzip.c b/archival/bbunzip.c index c5a533700..bccc8f898 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c | |||
@@ -49,7 +49,7 @@ int bbunpack(char **argv, | |||
49 | /* Open src */ | 49 | /* Open src */ |
50 | if (filename) { | 50 | if (filename) { |
51 | if (stat(filename, &stat_buf) != 0) { | 51 | if (stat(filename, &stat_buf) != 0) { |
52 | bb_perror_msg("%s", filename); | 52 | bb_simple_perror_msg(filename); |
53 | err: | 53 | err: |
54 | exitcode = 1; | 54 | exitcode = 1; |
55 | goto free_name; | 55 | goto free_name; |
diff --git a/coreutils/chmod.c b/coreutils/chmod.c index 8b214991a..dd7b78412 100644 --- a/coreutils/chmod.c +++ b/coreutils/chmod.c | |||
@@ -63,7 +63,7 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* param, i | |||
63 | } | 63 | } |
64 | err: | 64 | err: |
65 | if (!OPT_QUIET) | 65 | if (!OPT_QUIET) |
66 | bb_perror_msg("%s", fileName); | 66 | bb_simple_perror_msg(fileName); |
67 | return FALSE; | 67 | return FALSE; |
68 | } | 68 | } |
69 | 69 | ||
diff --git a/coreutils/chown.c b/coreutils/chown.c index cfd373456..d974493b6 100644 --- a/coreutils/chown.c +++ b/coreutils/chown.c | |||
@@ -57,7 +57,7 @@ static int fileAction(const char *fileName, struct stat *statbuf, | |||
57 | return TRUE; | 57 | return TRUE; |
58 | } | 58 | } |
59 | if (!OPT_QUIET) | 59 | if (!OPT_QUIET) |
60 | bb_perror_msg("%s", fileName); /* A filename can have % in it... */ | 60 | bb_simple_perror_msg(fileName); /* A filename can have % in it... */ |
61 | return FALSE; | 61 | return FALSE; |
62 | } | 62 | } |
63 | 63 | ||
diff --git a/coreutils/dd.c b/coreutils/dd.c index b17bb5969..b9f5b4cba 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c | |||
@@ -278,7 +278,7 @@ int dd_main(int argc, char **argv) | |||
278 | if (n < 0) { | 278 | if (n < 0) { |
279 | if (flags & FLAG_NOERROR) { | 279 | if (flags & FLAG_NOERROR) { |
280 | n = ibs; | 280 | n = ibs; |
281 | bb_perror_msg("%s", infile); | 281 | bb_simple_perror_msg(infile); |
282 | } else | 282 | } else |
283 | goto die_infile; | 283 | goto die_infile; |
284 | } | 284 | } |
@@ -320,12 +320,12 @@ int dd_main(int argc, char **argv) | |||
320 | } | 320 | } |
321 | if (close(ifd) < 0) { | 321 | if (close(ifd) < 0) { |
322 | die_infile: | 322 | die_infile: |
323 | bb_perror_msg_and_die("%s", infile); | 323 | bb_simple_perror_msg_and_die(infile); |
324 | } | 324 | } |
325 | 325 | ||
326 | if (close(ofd) < 0) { | 326 | if (close(ofd) < 0) { |
327 | die_outfile: | 327 | die_outfile: |
328 | bb_perror_msg_and_die("%s", outfile); | 328 | bb_simple_perror_msg_and_die(outfile); |
329 | } | 329 | } |
330 | out_status: | 330 | out_status: |
331 | dd_output_status(0); | 331 | dd_output_status(0); |
diff --git a/coreutils/df.c b/coreutils/df.c index 7eb82cd46..6fe8e2fba 100644 --- a/coreutils/df.c +++ b/coreutils/df.c | |||
@@ -100,7 +100,7 @@ int df_main(int argc, char **argv) | |||
100 | mount_point = mount_entry->mnt_dir; | 100 | mount_point = mount_entry->mnt_dir; |
101 | 101 | ||
102 | if (statfs(mount_point, &s) != 0) { | 102 | if (statfs(mount_point, &s) != 0) { |
103 | bb_perror_msg("%s", mount_point); | 103 | bb_simple_perror_msg(mount_point); |
104 | goto SET_ERROR; | 104 | goto SET_ERROR; |
105 | } | 105 | } |
106 | 106 | ||
diff --git a/coreutils/du.c b/coreutils/du.c index b5e68d8f8..2697acf13 100644 --- a/coreutils/du.c +++ b/coreutils/du.c | |||
@@ -67,7 +67,7 @@ static unsigned long du(const char *filename) | |||
67 | unsigned long sum; | 67 | unsigned long sum; |
68 | 68 | ||
69 | if (lstat(filename, &statbuf) != 0) { | 69 | if (lstat(filename, &statbuf) != 0) { |
70 | bb_perror_msg("%s", filename); | 70 | bb_simple_perror_msg(filename); |
71 | G.status = EXIT_FAILURE; | 71 | G.status = EXIT_FAILURE; |
72 | return 0; | 72 | return 0; |
73 | } | 73 | } |
@@ -85,7 +85,7 @@ static unsigned long du(const char *filename) | |||
85 | if (S_ISLNK(statbuf.st_mode)) { | 85 | if (S_ISLNK(statbuf.st_mode)) { |
86 | if (G.slink_depth > G.du_depth) { /* -H or -L */ | 86 | if (G.slink_depth > G.du_depth) { /* -H or -L */ |
87 | if (stat(filename, &statbuf) != 0) { | 87 | if (stat(filename, &statbuf) != 0) { |
88 | bb_perror_msg("%s", filename); | 88 | bb_simple_perror_msg(filename); |
89 | G.status = EXIT_FAILURE; | 89 | G.status = EXIT_FAILURE; |
90 | return 0; | 90 | return 0; |
91 | } | 91 | } |
diff --git a/coreutils/env.c b/coreutils/env.c index 8d2d881fa..5d0cd8256 100644 --- a/coreutils/env.c +++ b/coreutils/env.c | |||
@@ -81,7 +81,7 @@ int env_main(int argc, char** argv) | |||
81 | BB_EXECVP(*argv, argv); | 81 | BB_EXECVP(*argv, argv); |
82 | /* SUSv3-mandated exit codes. */ | 82 | /* SUSv3-mandated exit codes. */ |
83 | xfunc_error_retval = (errno == ENOENT) ? 127 : 126; | 83 | xfunc_error_retval = (errno == ENOENT) ? 127 : 126; |
84 | bb_perror_msg_and_die("%s", *argv); | 84 | bb_simple_perror_msg_and_die(*argv); |
85 | } | 85 | } |
86 | 86 | ||
87 | for (ep = environ; *ep; ep++) { | 87 | for (ep = environ; *ep; ep++) { |
diff --git a/coreutils/expand.c b/coreutils/expand.c index 274753fd4..0ef106dbf 100644 --- a/coreutils/expand.c +++ b/coreutils/expand.c | |||
@@ -192,7 +192,7 @@ int expand_main(int argc, char **argv) | |||
192 | /* Check and close the file */ | 192 | /* Check and close the file */ |
193 | /* We do want all of them to execute, thus | instead of || */ | 193 | /* We do want all of them to execute, thus | instead of || */ |
194 | if (ferror(file) | fclose_if_not_stdin(file)) { | 194 | if (ferror(file) | fclose_if_not_stdin(file)) { |
195 | bb_perror_msg("%s", *argv); | 195 | bb_simple_perror_msg(*argv); |
196 | exit_status = EXIT_FAILURE; | 196 | exit_status = EXIT_FAILURE; |
197 | } | 197 | } |
198 | /* If stdin also clear EOF */ | 198 | /* If stdin also clear EOF */ |
diff --git a/coreutils/fold.c b/coreutils/fold.c index a75f4666e..bf4b19831 100644 --- a/coreutils/fold.c +++ b/coreutils/fold.c | |||
@@ -145,7 +145,7 @@ int fold_main(int argc, char **argv) | |||
145 | } | 145 | } |
146 | 146 | ||
147 | if (ferror(istream) || fclose_if_not_stdin(istream)) { | 147 | if (ferror(istream) || fclose_if_not_stdin(istream)) { |
148 | bb_perror_msg("%s", *argv); /* Avoid multibyte problems. */ | 148 | bb_simple_perror_msg(*argv); /* Avoid multibyte problems. */ |
149 | errs |= EXIT_FAILURE; | 149 | errs |= EXIT_FAILURE; |
150 | } | 150 | } |
151 | } while (*++argv); | 151 | } while (*++argv); |
diff --git a/coreutils/head.c b/coreutils/head.c index a48f147a2..af9e9f41e 100644 --- a/coreutils/head.c +++ b/coreutils/head.c | |||
@@ -128,7 +128,7 @@ int head_main(int argc, char **argv) | |||
128 | putchar(c); | 128 | putchar(c); |
129 | } | 129 | } |
130 | if (fclose_if_not_stdin(fp)) { | 130 | if (fclose_if_not_stdin(fp)) { |
131 | bb_perror_msg("%s", *argv); /* Avoid multibyte problems. */ | 131 | bb_simple_perror_msg(*argv); /* Avoid multibyte problems. */ |
132 | retval = EXIT_FAILURE; | 132 | retval = EXIT_FAILURE; |
133 | } | 133 | } |
134 | die_if_ferror_stdout(); | 134 | die_if_ferror_stdout(); |
diff --git a/coreutils/ln.c b/coreutils/ln.c index f3c67aa36..658e32e94 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c | |||
@@ -64,7 +64,7 @@ int ln_main(int argc, char **argv) | |||
64 | if (!(flag & LN_SYMLINK) && stat(*argv, &statbuf)) { | 64 | if (!(flag & LN_SYMLINK) && stat(*argv, &statbuf)) { |
65 | // coreutils: "ln dangling_symlink new_hardlink" works | 65 | // coreutils: "ln dangling_symlink new_hardlink" works |
66 | if (lstat(*argv, &statbuf) || !S_ISLNK(statbuf.st_mode)) { | 66 | if (lstat(*argv, &statbuf) || !S_ISLNK(statbuf.st_mode)) { |
67 | bb_perror_msg("%s", *argv); | 67 | bb_simple_perror_msg(*argv); |
68 | status = EXIT_FAILURE; | 68 | status = EXIT_FAILURE; |
69 | free(src_name); | 69 | free(src_name); |
70 | continue; | 70 | continue; |
@@ -75,7 +75,7 @@ int ln_main(int argc, char **argv) | |||
75 | char *backup; | 75 | char *backup; |
76 | backup = xasprintf("%s%s", src, suffix); | 76 | backup = xasprintf("%s%s", src, suffix); |
77 | if (rename(src, backup) < 0 && errno != ENOENT) { | 77 | if (rename(src, backup) < 0 && errno != ENOENT) { |
78 | bb_perror_msg("%s", src); | 78 | bb_simple_perror_msg(src); |
79 | status = EXIT_FAILURE; | 79 | status = EXIT_FAILURE; |
80 | free(backup); | 80 | free(backup); |
81 | continue; | 81 | continue; |
@@ -97,7 +97,7 @@ int ln_main(int argc, char **argv) | |||
97 | } | 97 | } |
98 | 98 | ||
99 | if (link_func(*argv, src) != 0) { | 99 | if (link_func(*argv, src) != 0) { |
100 | bb_perror_msg("%s", src); | 100 | bb_simple_perror_msg(src); |
101 | status = EXIT_FAILURE; | 101 | status = EXIT_FAILURE; |
102 | } | 102 | } |
103 | 103 | ||
diff --git a/coreutils/ls.c b/coreutils/ls.c index a4acc98ad..92a9a289d 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -171,7 +171,7 @@ static struct dnode *my_stat(const char *fullname, const char *name, int force_f | |||
171 | } | 171 | } |
172 | #endif | 172 | #endif |
173 | if (stat(fullname, &dstat)) { | 173 | if (stat(fullname, &dstat)) { |
174 | bb_perror_msg("%s", fullname); | 174 | bb_simple_perror_msg(fullname); |
175 | status = EXIT_FAILURE; | 175 | status = EXIT_FAILURE; |
176 | return 0; | 176 | return 0; |
177 | } | 177 | } |
@@ -182,7 +182,7 @@ static struct dnode *my_stat(const char *fullname, const char *name, int force_f | |||
182 | } | 182 | } |
183 | #endif | 183 | #endif |
184 | if (lstat(fullname, &dstat)) { | 184 | if (lstat(fullname, &dstat)) { |
185 | bb_perror_msg("%s", fullname); | 185 | bb_simple_perror_msg(fullname); |
186 | status = EXIT_FAILURE; | 186 | status = EXIT_FAILURE; |
187 | return 0; | 187 | return 0; |
188 | } | 188 | } |
diff --git a/coreutils/mkfifo.c b/coreutils/mkfifo.c index 030c9d22f..e66f81778 100644 --- a/coreutils/mkfifo.c +++ b/coreutils/mkfifo.c | |||
@@ -28,7 +28,7 @@ int mkfifo_main(int argc, char **argv) | |||
28 | 28 | ||
29 | do { | 29 | do { |
30 | if (mkfifo(*argv, mode) < 0) { | 30 | if (mkfifo(*argv, mode) < 0) { |
31 | bb_perror_msg("%s", *argv); /* Avoid multibyte problems. */ | 31 | bb_simple_perror_msg(*argv); /* Avoid multibyte problems. */ |
32 | retval = EXIT_FAILURE; | 32 | retval = EXIT_FAILURE; |
33 | } | 33 | } |
34 | } while (*++argv); | 34 | } while (*++argv); |
diff --git a/coreutils/mknod.c b/coreutils/mknod.c index ea6f24ae6..a876daaf1 100644 --- a/coreutils/mknod.c +++ b/coreutils/mknod.c | |||
@@ -44,7 +44,7 @@ int mknod_main(int argc, char **argv) | |||
44 | if (mknod(name, mode, dev) == 0) { | 44 | if (mknod(name, mode, dev) == 0) { |
45 | return EXIT_SUCCESS; | 45 | return EXIT_SUCCESS; |
46 | } | 46 | } |
47 | bb_perror_msg_and_die("%s", name); | 47 | bb_simple_perror_msg_and_die(name); |
48 | } | 48 | } |
49 | } | 49 | } |
50 | bb_show_usage(); | 50 | bb_show_usage(); |
diff --git a/coreutils/nice.c b/coreutils/nice.c index 8d77ae472..0cb31e4fa 100644 --- a/coreutils/nice.c +++ b/coreutils/nice.c | |||
@@ -51,5 +51,5 @@ int nice_main(int argc, char **argv) | |||
51 | 51 | ||
52 | /* The exec failed... */ | 52 | /* The exec failed... */ |
53 | xfunc_error_retval = (errno == ENOENT) ? 127 : 126; /* SUSv3 */ | 53 | xfunc_error_retval = (errno == ENOENT) ? 127 : 126; /* SUSv3 */ |
54 | bb_perror_msg_and_die("%s", *argv); | 54 | bb_simple_perror_msg_and_die(*argv); |
55 | } | 55 | } |
diff --git a/coreutils/nohup.c b/coreutils/nohup.c index 22419b800..e27bd2e35 100644 --- a/coreutils/nohup.c +++ b/coreutils/nohup.c | |||
@@ -56,5 +56,5 @@ int nohup_main(int argc, char **argv) | |||
56 | BB_EXECVP(argv[1], argv+1); | 56 | BB_EXECVP(argv[1], argv+1); |
57 | if (ENABLE_FEATURE_CLEAN_UP && home) | 57 | if (ENABLE_FEATURE_CLEAN_UP && home) |
58 | free((char*)nohupout); | 58 | free((char*)nohupout); |
59 | bb_perror_msg_and_die("%s", argv[1]); | 59 | bb_simple_perror_msg_and_die(argv[1]); |
60 | } | 60 | } |
diff --git a/coreutils/realpath.c b/coreutils/realpath.c index 7c5dc3b10..9c4298720 100644 --- a/coreutils/realpath.c +++ b/coreutils/realpath.c | |||
@@ -35,7 +35,7 @@ int realpath_main(int argc, char **argv) | |||
35 | puts(resolved_path); | 35 | puts(resolved_path); |
36 | } else { | 36 | } else { |
37 | retval = EXIT_FAILURE; | 37 | retval = EXIT_FAILURE; |
38 | bb_perror_msg("%s", *argv); | 38 | bb_simple_perror_msg(*argv); |
39 | } | 39 | } |
40 | } while (--argc); | 40 | } while (--argc); |
41 | 41 | ||
diff --git a/coreutils/split.c b/coreutils/split.c index 3ec539a6a..6d8924aeb 100644 --- a/coreutils/split.c +++ b/coreutils/split.c | |||
@@ -104,7 +104,7 @@ int split_main(int argc, char **argv) | |||
104 | if (!bytes_read) | 104 | if (!bytes_read) |
105 | break; | 105 | break; |
106 | if (bytes_read < 0) | 106 | if (bytes_read < 0) |
107 | bb_perror_msg_and_die("%s", argv[0]); | 107 | bb_simple_perror_msg_and_die(argv[0]); |
108 | src = read_buffer; | 108 | src = read_buffer; |
109 | do { | 109 | do { |
110 | if (!remaining) { | 110 | if (!remaining) { |
diff --git a/coreutils/touch.c b/coreutils/touch.c index 7a1dd3599..d8498d854 100644 --- a/coreutils/touch.c +++ b/coreutils/touch.c | |||
@@ -49,7 +49,7 @@ int touch_main(int argc, char **argv) | |||
49 | } | 49 | } |
50 | } | 50 | } |
51 | status = EXIT_FAILURE; | 51 | status = EXIT_FAILURE; |
52 | bb_perror_msg("%s", *argv); | 52 | bb_simple_perror_msg(*argv); |
53 | } | 53 | } |
54 | } while (*++argv); | 54 | } while (*++argv); |
55 | 55 | ||
diff --git a/coreutils/wc.c b/coreutils/wc.c index e86b7d4d2..c8a4865b1 100644 --- a/coreutils/wc.c +++ b/coreutils/wc.c | |||
@@ -150,7 +150,7 @@ int wc_main(int argc, char **argv) | |||
150 | } | 150 | } |
151 | } else if (c == EOF) { | 151 | } else if (c == EOF) { |
152 | if (ferror(fp)) { | 152 | if (ferror(fp)) { |
153 | bb_perror_msg("%s", arg); | 153 | bb_simple_perror_msg(arg); |
154 | status = EXIT_FAILURE; | 154 | status = EXIT_FAILURE; |
155 | } | 155 | } |
156 | --counts[WC_CHARS]; | 156 | --counts[WC_CHARS]; |
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c index 3717781db..110b3d246 100644 --- a/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c | |||
@@ -659,7 +659,7 @@ static void execute(const char *type, const char *device, const char *mntpt, | |||
659 | if (!noexecute) { | 659 | if (!noexecute) { |
660 | pid = spawn(argv); | 660 | pid = spawn(argv); |
661 | if (pid < 0) | 661 | if (pid < 0) |
662 | bb_perror_msg("%s", argv[0]); | 662 | bb_simple_perror_msg(argv[0]); |
663 | } | 663 | } |
664 | 664 | ||
665 | for (i = num_args+1; i < argc; i++) | 665 | for (i = num_args+1; i < argc; i++) |
diff --git a/e2fsprogs/old_e2fsprogs/fsck.c b/e2fsprogs/old_e2fsprogs/fsck.c index aad85cf61..7e7383898 100644 --- a/e2fsprogs/old_e2fsprogs/fsck.c +++ b/e2fsprogs/old_e2fsprogs/fsck.c | |||
@@ -626,7 +626,7 @@ static int execute(const char *type, const char *device, const char *mntpt, | |||
626 | if (!interactive) | 626 | if (!interactive) |
627 | close(0); | 627 | close(0); |
628 | (void) execv(s, argv); | 628 | (void) execv(s, argv); |
629 | bb_perror_msg_and_die("%s", argv[0]); | 629 | bb_simple_perror_msg_and_die(argv[0]); |
630 | } | 630 | } |
631 | 631 | ||
632 | for (i = 1; i < argc; i++) | 632 | for (i = 1; i < argc; i++) |
diff --git a/findutils/find.c b/findutils/find.c index f3167a083..b61881497 100644 --- a/findutils/find.c +++ b/findutils/find.c | |||
@@ -277,7 +277,7 @@ ACTF(exec) | |||
277 | 277 | ||
278 | rc = spawn_and_wait(argv); | 278 | rc = spawn_and_wait(argv); |
279 | if (rc < 0) | 279 | if (rc < 0) |
280 | bb_perror_msg("%s", argv[0]); | 280 | bb_simple_perror_msg(argv[0]); |
281 | 281 | ||
282 | i = 0; | 282 | i = 0; |
283 | while (argv[i]) | 283 | while (argv[i]) |
@@ -347,7 +347,7 @@ ACTF(delete) | |||
347 | rc = unlink(fileName); | 347 | rc = unlink(fileName); |
348 | } | 348 | } |
349 | if (rc < 0) | 349 | if (rc < 0) |
350 | bb_perror_msg("%s", fileName); | 350 | bb_simple_perror_msg(fileName); |
351 | return TRUE; | 351 | return TRUE; |
352 | } | 352 | } |
353 | #endif | 353 | #endif |
@@ -780,7 +780,7 @@ static action*** parse_params(char **argv) | |||
780 | ap->context = NULL; | 780 | ap->context = NULL; |
781 | /* SELinux headers erroneously declare non-const parameter */ | 781 | /* SELinux headers erroneously declare non-const parameter */ |
782 | if (selinux_raw_to_trans_context((char*)arg1, &ap->context)) | 782 | if (selinux_raw_to_trans_context((char*)arg1, &ap->context)) |
783 | bb_perror_msg("%s", arg1); | 783 | bb_simple_perror_msg(arg1); |
784 | } | 784 | } |
785 | #endif | 785 | #endif |
786 | else { | 786 | else { |
diff --git a/findutils/grep.c b/findutils/grep.c index 3a9c74073..2d886a025 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -369,7 +369,7 @@ static int file_action_grep(const char *filename, struct stat *statbuf, void* ma | |||
369 | FILE *file = fopen(filename, "r"); | 369 | FILE *file = fopen(filename, "r"); |
370 | if (file == NULL) { | 370 | if (file == NULL) { |
371 | if (!SUPPRESS_ERR_MSGS) | 371 | if (!SUPPRESS_ERR_MSGS) |
372 | bb_perror_msg("%s", cur_file); | 372 | bb_simple_perror_msg(cur_file); |
373 | open_errors = 1; | 373 | open_errors = 1; |
374 | return 0; | 374 | return 0; |
375 | } | 375 | } |
@@ -517,7 +517,7 @@ int grep_main(int argc, char **argv) | |||
517 | file = fopen(cur_file, "r"); | 517 | file = fopen(cur_file, "r"); |
518 | if (file == NULL) { | 518 | if (file == NULL) { |
519 | if (!SUPPRESS_ERR_MSGS) | 519 | if (!SUPPRESS_ERR_MSGS) |
520 | bb_perror_msg("%s", cur_file); | 520 | bb_simple_perror_msg(cur_file); |
521 | open_errors = 1; | 521 | open_errors = 1; |
522 | continue; | 522 | continue; |
523 | } | 523 | } |
diff --git a/findutils/xargs.c b/findutils/xargs.c index 7a8899631..f7c7832d5 100644 --- a/findutils/xargs.c +++ b/findutils/xargs.c | |||
@@ -57,7 +57,7 @@ static int xargs_exec(char **args) | |||
57 | 57 | ||
58 | status = spawn_and_wait(args); | 58 | status = spawn_and_wait(args); |
59 | if (status < 0) { | 59 | if (status < 0) { |
60 | bb_perror_msg("%s", args[0]); | 60 | bb_simple_perror_msg(args[0]); |
61 | return errno == ENOENT ? 127 : 126; | 61 | return errno == ENOENT ? 127 : 126; |
62 | } | 62 | } |
63 | if (status == 255) { | 63 | if (status == 255) { |
diff --git a/include/libbb.h b/include/libbb.h index a8463ae49..d76571b58 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -677,7 +677,9 @@ extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE; | |||
677 | extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); | 677 | extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); |
678 | extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); | 678 | extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); |
679 | extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); | 679 | extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); |
680 | extern void bb_simple_perror_msg(const char *s); | ||
680 | extern void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); | 681 | extern void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); |
682 | extern void bb_simple_perror_msg_and_die(const char *s) __attribute__ ((noreturn)); | ||
681 | extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); | 683 | extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); |
682 | extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); | 684 | extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); |
683 | extern void bb_perror_nomsg_and_die(void) ATTRIBUTE_NORETURN; | 685 | extern void bb_perror_nomsg_and_die(void) ATTRIBUTE_NORETURN; |
@@ -1185,7 +1187,6 @@ extern const char bb_default_login_shell[]; | |||
1185 | #include <dmalloc.h> | 1187 | #include <dmalloc.h> |
1186 | #endif | 1188 | #endif |
1187 | 1189 | ||
1188 | |||
1189 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | 1190 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
1190 | 1191 | ||
1191 | #endif /* __LIBBUSYBOX_H__ */ | 1192 | #endif /* __LIBBUSYBOX_H__ */ |
diff --git a/init/mesg.c b/init/mesg.c index e182b4153..1a576cb37 100644 --- a/init/mesg.c +++ b/init/mesg.c | |||
@@ -40,7 +40,7 @@ int mesg_main(int argc, char **argv) | |||
40 | return EXIT_SUCCESS; | 40 | return EXIT_SUCCESS; |
41 | } | 41 | } |
42 | } | 42 | } |
43 | bb_perror_msg_and_die("%s", tty); | 43 | bb_simple_perror_msg_and_die(tty); |
44 | } | 44 | } |
45 | bb_show_usage(); | 45 | bb_show_usage(); |
46 | } | 46 | } |
diff --git a/libbb/change_identity.c b/libbb/change_identity.c index 3f888f523..b2274e0ae 100644 --- a/libbb/change_identity.c +++ b/libbb/change_identity.c | |||
@@ -47,5 +47,5 @@ void change_identity(const struct passwd *pw) | |||
47 | const char *err_msg = change_identity_e2str(pw); | 47 | const char *err_msg = change_identity_e2str(pw); |
48 | 48 | ||
49 | if (err_msg) | 49 | if (err_msg) |
50 | bb_perror_msg_and_die("%s", err_msg); | 50 | bb_simple_perror_msg_and_die(err_msg); |
51 | } | 51 | } |
diff --git a/libbb/dump.c b/libbb/dump.c index 0d1bb18f2..829050d69 100644 --- a/libbb/dump.c +++ b/libbb/dump.c | |||
@@ -297,7 +297,7 @@ static void do_skip(const char *fname, int statok) | |||
297 | 297 | ||
298 | if (statok) { | 298 | if (statok) { |
299 | if (fstat(STDIN_FILENO, &sbuf)) { | 299 | if (fstat(STDIN_FILENO, &sbuf)) { |
300 | bb_perror_msg_and_die("%s", fname); | 300 | bb_simple_perror_msg_and_die(fname); |
301 | } | 301 | } |
302 | if ((!(S_ISCHR(sbuf.st_mode) || | 302 | if ((!(S_ISCHR(sbuf.st_mode) || |
303 | S_ISBLK(sbuf.st_mode) || | 303 | S_ISBLK(sbuf.st_mode) || |
@@ -309,7 +309,7 @@ static void do_skip(const char *fname, int statok) | |||
309 | } | 309 | } |
310 | } | 310 | } |
311 | if (fseek(stdin, bb_dump_skip, SEEK_SET)) { | 311 | if (fseek(stdin, bb_dump_skip, SEEK_SET)) { |
312 | bb_perror_msg_and_die("%s", fname); | 312 | bb_simple_perror_msg_and_die(fname); |
313 | } | 313 | } |
314 | savaddress = address += bb_dump_skip; | 314 | savaddress = address += bb_dump_skip; |
315 | bb_dump_skip = 0; | 315 | bb_dump_skip = 0; |
@@ -328,7 +328,7 @@ static int next(char **argv) | |||
328 | for (;;) { | 328 | for (;;) { |
329 | if (*_argv) { | 329 | if (*_argv) { |
330 | if (!(freopen(*_argv, "r", stdin))) { | 330 | if (!(freopen(*_argv, "r", stdin))) { |
331 | bb_perror_msg("%s", *_argv); | 331 | bb_simple_perror_msg(*_argv); |
332 | exitval = 1; | 332 | exitval = 1; |
333 | ++_argv; | 333 | ++_argv; |
334 | continue; | 334 | continue; |
@@ -393,7 +393,7 @@ static unsigned char *get(void) | |||
393 | bb_dump_length == -1 ? need : MIN(bb_dump_length, need), stdin); | 393 | bb_dump_length == -1 ? need : MIN(bb_dump_length, need), stdin); |
394 | if (!n) { | 394 | if (!n) { |
395 | if (ferror(stdin)) { | 395 | if (ferror(stdin)) { |
396 | bb_perror_msg("%s", _argv[-1]); | 396 | bb_simple_perror_msg(_argv[-1]); |
397 | } | 397 | } |
398 | ateof = 1; | 398 | ateof = 1; |
399 | continue; | 399 | continue; |
diff --git a/libbb/perror_msg.c b/libbb/perror_msg.c index a958cff00..af9ff5949 100644 --- a/libbb/perror_msg.c +++ b/libbb/perror_msg.c | |||
@@ -18,3 +18,8 @@ void bb_perror_msg(const char *s, ...) | |||
18 | bb_verror_msg(s, p, errno ? strerror(errno) : NULL); | 18 | bb_verror_msg(s, p, errno ? strerror(errno) : NULL); |
19 | va_end(p); | 19 | va_end(p); |
20 | } | 20 | } |
21 | |||
22 | void bb_simple_perror_msg(const char *s) | ||
23 | { | ||
24 | bb_perror_msg("%s", s); | ||
25 | } | ||
diff --git a/libbb/perror_msg_and_die.c b/libbb/perror_msg_and_die.c index 15f46fc05..7b500736a 100644 --- a/libbb/perror_msg_and_die.c +++ b/libbb/perror_msg_and_die.c | |||
@@ -19,3 +19,8 @@ void bb_perror_msg_and_die(const char *s, ...) | |||
19 | va_end(p); | 19 | va_end(p); |
20 | xfunc_die(); | 20 | xfunc_die(); |
21 | } | 21 | } |
22 | |||
23 | void bb_simple_perror_msg_and_die(const char *s) | ||
24 | { | ||
25 | bb_perror_msg_and_die("%s", s); | ||
26 | } | ||
diff --git a/libbb/recursive_action.c b/libbb/recursive_action.c index cb3b88d1d..37363bb3e 100644 --- a/libbb/recursive_action.c +++ b/libbb/recursive_action.c | |||
@@ -120,6 +120,6 @@ int recursive_action(const char *fileName, | |||
120 | return TRUE; | 120 | return TRUE; |
121 | 121 | ||
122 | done_nak_warn: | 122 | done_nak_warn: |
123 | bb_perror_msg("%s", fileName); | 123 | bb_simple_perror_msg(fileName); |
124 | return FALSE; | 124 | return FALSE; |
125 | } | 125 | } |
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c index 558510bc6..80c72f165 100644 --- a/libbb/vfork_daemon_rexec.c +++ b/libbb/vfork_daemon_rexec.c | |||
@@ -62,7 +62,7 @@ pid_t xspawn(char **argv) | |||
62 | { | 62 | { |
63 | pid_t pid = spawn(argv); | 63 | pid_t pid = spawn(argv); |
64 | if (pid < 0) | 64 | if (pid < 0) |
65 | bb_perror_msg_and_die("%s", *argv); | 65 | bb_simple_perror_msg_and_die(*argv); |
66 | return pid; | 66 | return pid; |
67 | } | 67 | } |
68 | 68 | ||
diff --git a/libbb/wfopen.c b/libbb/wfopen.c index 26e6a13e2..9248874a7 100644 --- a/libbb/wfopen.c +++ b/libbb/wfopen.c | |||
@@ -13,7 +13,7 @@ FILE *fopen_or_warn(const char *path, const char *mode) | |||
13 | { | 13 | { |
14 | FILE *fp = fopen(path, mode); | 14 | FILE *fp = fopen(path, mode); |
15 | if (!fp) { | 15 | if (!fp) { |
16 | bb_perror_msg("%s", path); | 16 | bb_simple_perror_msg(path); |
17 | errno = 0; | 17 | errno = 0; |
18 | } | 18 | } |
19 | return fp; | 19 | return fp; |
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index 2bf20f3a0..6d8eac4b6 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c | |||
@@ -704,13 +704,13 @@ int bb_ioctl_or_warn(int fd, int request, void *argp, const char *ioctl_name) | |||
704 | 704 | ||
705 | ret = ioctl(fd, request, argp); | 705 | ret = ioctl(fd, request, argp); |
706 | if (ret < 0) | 706 | if (ret < 0) |
707 | bb_perror_msg("%s", ioctl_name); | 707 | bb_simple_perror_msg(ioctl_name); |
708 | return ret; | 708 | return ret; |
709 | } | 709 | } |
710 | void bb_xioctl(int fd, int request, void *argp, const char *ioctl_name) | 710 | void bb_xioctl(int fd, int request, void *argp, const char *ioctl_name) |
711 | { | 711 | { |
712 | if (ioctl(fd, request, argp) < 0) | 712 | if (ioctl(fd, request, argp) < 0) |
713 | bb_perror_msg_and_die("%s", ioctl_name); | 713 | bb_simple_perror_msg_and_die(ioctl_name); |
714 | } | 714 | } |
715 | #else | 715 | #else |
716 | int bb_ioctl_or_warn(int fd, int request, void *argp) | 716 | int bb_ioctl_or_warn(int fd, int request, void *argp) |
diff --git a/loginutils/adduser.c b/loginutils/adduser.c index eee4a000d..149ea9c4b 100644 --- a/loginutils/adduser.c +++ b/loginutils/adduser.c | |||
@@ -144,7 +144,7 @@ static int adduser(struct passwd *p) | |||
144 | if (mkdir(p->pw_dir, 0755) | 144 | if (mkdir(p->pw_dir, 0755) |
145 | || chown(p->pw_dir, p->pw_uid, p->pw_gid) | 145 | || chown(p->pw_dir, p->pw_uid, p->pw_gid) |
146 | || chmod(p->pw_dir, 02755)) { | 146 | || chmod(p->pw_dir, 02755)) { |
147 | bb_perror_msg("%s", p->pw_dir); | 147 | bb_simple_perror_msg(p->pw_dir); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
diff --git a/miscutils/chrt.c b/miscutils/chrt.c index 98399cedb..1f5465c40 100644 --- a/miscutils/chrt.c +++ b/miscutils/chrt.c | |||
@@ -115,7 +115,7 @@ print_rt_info: | |||
115 | } | 115 | } |
116 | ++argv; | 116 | ++argv; |
117 | BB_EXECVP(*argv, argv); | 117 | BB_EXECVP(*argv, argv); |
118 | bb_perror_msg_and_die("%s", *argv); | 118 | bb_simple_perror_msg_and_die(*argv); |
119 | } | 119 | } |
120 | #undef OPT_p | 120 | #undef OPT_p |
121 | #undef OPT_r | 121 | #undef OPT_r |
diff --git a/miscutils/mountpoint.c b/miscutils/mountpoint.c index 0f1e155ae..376bd9531 100644 --- a/miscutils/mountpoint.c +++ b/miscutils/mountpoint.c | |||
@@ -61,6 +61,6 @@ int mountpoint_main(int argc, char **argv) | |||
61 | } | 61 | } |
62 | } | 62 | } |
63 | if (!(opt & OPT_q)) | 63 | if (!(opt & OPT_q)) |
64 | bb_perror_msg("%s", arg); | 64 | bb_simple_perror_msg(arg); |
65 | return EXIT_FAILURE; | 65 | return EXIT_FAILURE; |
66 | } | 66 | } |
diff --git a/miscutils/setsid.c b/miscutils/setsid.c index a976fe93b..8d738edfb 100644 --- a/miscutils/setsid.c +++ b/miscutils/setsid.c | |||
@@ -29,5 +29,5 @@ int setsid_main(int argc, char **argv) | |||
29 | setsid(); /* no error possible */ | 29 | setsid(); /* no error possible */ |
30 | 30 | ||
31 | BB_EXECVP(argv[1], argv + 1); | 31 | BB_EXECVP(argv[1], argv + 1); |
32 | bb_perror_msg_and_die("%s", argv[1]); | 32 | bb_simple_perror_msg_and_die(argv[1]); |
33 | } | 33 | } |
diff --git a/miscutils/taskset.c b/miscutils/taskset.c index 0c4bad7ed..3c117da92 100644 --- a/miscutils/taskset.c +++ b/miscutils/taskset.c | |||
@@ -92,7 +92,7 @@ int taskset_main(int argc, char** argv) | |||
92 | } | 92 | } |
93 | ++argv; | 93 | ++argv; |
94 | BB_EXECVP(*argv, argv); | 94 | BB_EXECVP(*argv, argv); |
95 | bb_perror_msg_and_die("%s", *argv); | 95 | bb_simple_perror_msg_and_die(*argv); |
96 | } | 96 | } |
97 | #undef OPT_p | 97 | #undef OPT_p |
98 | #undef TASKSET_PRINTF_MASK | 98 | #undef TASKSET_PRINTF_MASK |
diff --git a/modutils/rmmod.c b/modutils/rmmod.c index 4a38e35a5..ba3e88ca6 100644 --- a/modutils/rmmod.c +++ b/modutils/rmmod.c | |||
@@ -85,7 +85,7 @@ int rmmod_main(int argc, char **argv) | |||
85 | } | 85 | } |
86 | 86 | ||
87 | if (syscall(__NR_delete_module, ENABLE_FEATURE_2_6_MODULES ? misc_buf : argv[n], flags)) { | 87 | if (syscall(__NR_delete_module, ENABLE_FEATURE_2_6_MODULES ? misc_buf : argv[n], flags)) { |
88 | bb_perror_msg("%s", argv[n]); | 88 | bb_simple_perror_msg(argv[n]); |
89 | ret = EXIT_FAILURE; | 89 | ret = EXIT_FAILURE; |
90 | } | 90 | } |
91 | } | 91 | } |
diff --git a/networking/httpd.c b/networking/httpd.c index c8fbefd5a..06a5a56bc 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -504,7 +504,7 @@ static void parse_conf(const char *path, int flag) | |||
504 | return; | 504 | return; |
505 | } | 505 | } |
506 | if (configFile && flag == FIRST_PARSE) /* if -c option given */ | 506 | if (configFile && flag == FIRST_PARSE) /* if -c option given */ |
507 | bb_perror_msg_and_die("%s", cf); | 507 | bb_simple_perror_msg_and_die(cf); |
508 | flag = FIND_FROM_HTTPD_ROOT; | 508 | flag = FIND_FROM_HTTPD_ROOT; |
509 | cf = httpd_conf; | 509 | cf = httpd_conf; |
510 | } | 510 | } |
diff --git a/networking/inetd.c b/networking/inetd.c index b16427882..6d72e13e8 100644 --- a/networking/inetd.c +++ b/networking/inetd.c | |||
@@ -983,7 +983,7 @@ static void config(int sig ATTRIBUTE_UNUSED) | |||
983 | char protoname[10]; | 983 | char protoname[10]; |
984 | 984 | ||
985 | if (!setconfig()) { | 985 | if (!setconfig()) { |
986 | bb_perror_msg("%s", config_filename); | 986 | bb_simple_perror_msg(config_filename); |
987 | return; | 987 | return; |
988 | } | 988 | } |
989 | for (sep = servtab; sep; sep = sep->se_next) | 989 | for (sep = servtab; sep; sep = sep->se_next) |
diff --git a/networking/netstat.c b/networking/netstat.c index 5bacb47cc..e5ed10eb4 100644 --- a/networking/netstat.c +++ b/networking/netstat.c | |||
@@ -464,7 +464,7 @@ static void do_info(const char *file, const char *name, void (*proc)(int, const | |||
464 | procinfo = fopen(file, "r"); | 464 | procinfo = fopen(file, "r"); |
465 | if (procinfo == NULL) { | 465 | if (procinfo == NULL) { |
466 | if (errno != ENOENT) { | 466 | if (errno != ENOENT) { |
467 | bb_perror_msg("%s", file); | 467 | bb_simple_perror_msg(file); |
468 | } else { | 468 | } else { |
469 | bb_error_msg("no support for '%s' on this system", name); | 469 | bb_error_msg("no support for '%s' on this system", name); |
470 | } | 470 | } |
diff --git a/selinux/setfiles.c b/selinux/setfiles.c index 0f7996fa6..5ae482e65 100644 --- a/selinux/setfiles.c +++ b/selinux/setfiles.c | |||
@@ -595,7 +595,7 @@ int setfiles_main(int argc, char **argv) | |||
595 | if (argc == 1) | 595 | if (argc == 1) |
596 | bb_show_usage(); | 596 | bb_show_usage(); |
597 | if (stat(argv[optind], &sb) < 0) { | 597 | if (stat(argv[optind], &sb) < 0) { |
598 | bb_perror_msg_and_die("%s", argv[optind]); | 598 | bb_simple_perror_msg_and_die(argv[optind]); |
599 | } | 599 | } |
600 | if (!S_ISREG(sb.st_mode)) { | 600 | if (!S_ISREG(sb.st_mode)) { |
601 | bb_error_msg_and_die("spec file %s is not a regular file", argv[optind]); | 601 | bb_error_msg_and_die("spec file %s is not a regular file", argv[optind]); |
@@ -603,7 +603,7 @@ int setfiles_main(int argc, char **argv) | |||
603 | /* Load the file contexts configuration and check it. */ | 603 | /* Load the file contexts configuration and check it. */ |
604 | rc = matchpathcon_init(argv[optind]); | 604 | rc = matchpathcon_init(argv[optind]); |
605 | if (rc < 0) { | 605 | if (rc < 0) { |
606 | bb_perror_msg_and_die("%s", argv[optind]); | 606 | bb_simple_perror_msg_and_die(argv[optind]); |
607 | } | 607 | } |
608 | 608 | ||
609 | optind++; | 609 | optind++; |
diff --git a/shell/lash.c b/shell/lash.c index af3a8f80b..b7a0a6a37 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -1159,7 +1159,7 @@ static int pseudo_exec(struct child_prog *child) | |||
1159 | 1159 | ||
1160 | /* Do not use bb_perror_msg_and_die() here, since we must not | 1160 | /* Do not use bb_perror_msg_and_die() here, since we must not |
1161 | * call exit() but should call _exit() instead */ | 1161 | * call exit() but should call _exit() instead */ |
1162 | bb_perror_msg("%s", child->argv[0]); | 1162 | bb_simple_perror_msg(child->argv[0]); |
1163 | _exit(EXIT_FAILURE); | 1163 | _exit(EXIT_FAILURE); |
1164 | } | 1164 | } |
1165 | 1165 | ||
diff --git a/util-linux/mount.c b/util-linux/mount.c index ea3300176..10ada5426 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -1655,7 +1655,7 @@ int mount_main(int argc, char **argv) | |||
1655 | && (i & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE)) | 1655 | && (i & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE)) |
1656 | ) { | 1656 | ) { |
1657 | rc = mount("", argv[0], "", i, ""); | 1657 | rc = mount("", argv[0], "", i, ""); |
1658 | if (rc) bb_perror_msg_and_die("%s", argv[0]); | 1658 | if (rc) bb_simple_perror_msg_and_die(argv[0]); |
1659 | goto clean_up; | 1659 | goto clean_up; |
1660 | } | 1660 | } |
1661 | 1661 | ||
diff --git a/util-linux/setarch.c b/util-linux/setarch.c index 2fb47f9e8..08294e55c 100644 --- a/util-linux/setarch.c +++ b/util-linux/setarch.c | |||
@@ -44,5 +44,5 @@ retry: | |||
44 | BB_EXECVP(argv[0], argv); | 44 | BB_EXECVP(argv[0], argv); |
45 | } | 45 | } |
46 | 46 | ||
47 | bb_perror_msg_and_die("%s", argv[0]); | 47 | bb_simple_perror_msg_and_die(argv[0]); |
48 | } | 48 | } |
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index 73fe105a9..db43aa52a 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c | |||
@@ -31,7 +31,7 @@ static int swap_enable_disable(char *device) | |||
31 | status = swapoff(device); | 31 | status = swapoff(device); |
32 | 32 | ||
33 | if (status != 0) { | 33 | if (status != 0) { |
34 | bb_perror_msg("%s", device); | 34 | bb_simple_perror_msg(device); |
35 | return 1; | 35 | return 1; |
36 | } | 36 | } |
37 | 37 | ||