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 /libbb | |
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.
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/change_identity.c | 2 | ||||
-rw-r--r-- | libbb/dump.c | 8 | ||||
-rw-r--r-- | libbb/perror_msg.c | 5 | ||||
-rw-r--r-- | libbb/perror_msg_and_die.c | 5 | ||||
-rw-r--r-- | libbb/recursive_action.c | 2 | ||||
-rw-r--r-- | libbb/vfork_daemon_rexec.c | 2 | ||||
-rw-r--r-- | libbb/wfopen.c | 2 | ||||
-rw-r--r-- | libbb/xfuncs.c | 4 |
8 files changed, 20 insertions, 10 deletions
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) |