diff options
author | Denis Vlasenko | 2007-10-01 11:58:38 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-10-01 11:58:38 +0000 |
commit | 0c97c9d43707da745fe2bc62ab2a69497ceaf666 (patch) | |
tree | 267d0feb99f457b68c09315b3f3aebe8dfd6d411 /libbb | |
parent | d65ea39ffc7503807fa95e8840c012a80c83e4f3 (diff) | |
download | busybox-0c97c9d43707da745fe2bc62ab2a69497ceaf666.zip busybox-0c97c9d43707da745fe2bc62ab2a69497ceaf666.tar.gz |
'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 3f888f5..b2274e0 100644 --- a/libbb/change_identity.c +++ b/libbb/change_identity.c @@ -47,5 +47,5 @@ void change_identity(const struct passwd *pw) const char *err_msg = change_identity_e2str(pw); if (err_msg) - bb_perror_msg_and_die("%s", err_msg); + bb_simple_perror_msg_and_die(err_msg); } diff --git a/libbb/dump.c b/libbb/dump.c index 0d1bb18..829050d 100644 --- a/libbb/dump.c +++ b/libbb/dump.c @@ -297,7 +297,7 @@ static void do_skip(const char *fname, int statok) if (statok) { if (fstat(STDIN_FILENO, &sbuf)) { - bb_perror_msg_and_die("%s", fname); + bb_simple_perror_msg_and_die(fname); } if ((!(S_ISCHR(sbuf.st_mode) || S_ISBLK(sbuf.st_mode) || @@ -309,7 +309,7 @@ static void do_skip(const char *fname, int statok) } } if (fseek(stdin, bb_dump_skip, SEEK_SET)) { - bb_perror_msg_and_die("%s", fname); + bb_simple_perror_msg_and_die(fname); } savaddress = address += bb_dump_skip; bb_dump_skip = 0; @@ -328,7 +328,7 @@ static int next(char **argv) for (;;) { if (*_argv) { if (!(freopen(*_argv, "r", stdin))) { - bb_perror_msg("%s", *_argv); + bb_simple_perror_msg(*_argv); exitval = 1; ++_argv; continue; @@ -393,7 +393,7 @@ static unsigned char *get(void) bb_dump_length == -1 ? need : MIN(bb_dump_length, need), stdin); if (!n) { if (ferror(stdin)) { - bb_perror_msg("%s", _argv[-1]); + bb_simple_perror_msg(_argv[-1]); } ateof = 1; continue; diff --git a/libbb/perror_msg.c b/libbb/perror_msg.c index a958cff..af9ff59 100644 --- a/libbb/perror_msg.c +++ b/libbb/perror_msg.c @@ -18,3 +18,8 @@ void bb_perror_msg(const char *s, ...) bb_verror_msg(s, p, errno ? strerror(errno) : NULL); va_end(p); } + +void bb_simple_perror_msg(const char *s) +{ + bb_perror_msg("%s", s); +} diff --git a/libbb/perror_msg_and_die.c b/libbb/perror_msg_and_die.c index 15f46fc..7b50073 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, ...) va_end(p); xfunc_die(); } + +void bb_simple_perror_msg_and_die(const char *s) +{ + bb_perror_msg_and_die("%s", s); +} diff --git a/libbb/recursive_action.c b/libbb/recursive_action.c index cb3b88d..37363bb 100644 --- a/libbb/recursive_action.c +++ b/libbb/recursive_action.c @@ -120,6 +120,6 @@ int recursive_action(const char *fileName, return TRUE; done_nak_warn: - bb_perror_msg("%s", fileName); + bb_simple_perror_msg(fileName); return FALSE; } diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c index 558510b..80c72f1 100644 --- a/libbb/vfork_daemon_rexec.c +++ b/libbb/vfork_daemon_rexec.c @@ -62,7 +62,7 @@ pid_t xspawn(char **argv) { pid_t pid = spawn(argv); if (pid < 0) - bb_perror_msg_and_die("%s", *argv); + bb_simple_perror_msg_and_die(*argv); return pid; } diff --git a/libbb/wfopen.c b/libbb/wfopen.c index 26e6a13..9248874 100644 --- a/libbb/wfopen.c +++ b/libbb/wfopen.c @@ -13,7 +13,7 @@ FILE *fopen_or_warn(const char *path, const char *mode) { FILE *fp = fopen(path, mode); if (!fp) { - bb_perror_msg("%s", path); + bb_simple_perror_msg(path); errno = 0; } return fp; diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index 2bf20f3..6d8eac4 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) ret = ioctl(fd, request, argp); if (ret < 0) - bb_perror_msg("%s", ioctl_name); + bb_simple_perror_msg(ioctl_name); return ret; } void bb_xioctl(int fd, int request, void *argp, const char *ioctl_name) { if (ioctl(fd, request, argp) < 0) - bb_perror_msg_and_die("%s", ioctl_name); + bb_simple_perror_msg_and_die(ioctl_name); } #else int bb_ioctl_or_warn(int fd, int request, void *argp) |