aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorGravatar Denis Vlasenko <vda.linux@googlemail.com>2007-10-01 11:58:38 +0000
committerGravatar Denis Vlasenko <vda.linux@googlemail.com>2007-10-01 11:58:38 +0000
commit0c97c9d43707da745fe2bc62ab2a69497ceaf666 (patch)
tree267d0feb99f457b68c09315b3f3aebe8dfd6d411 /libbb
parentd65ea39ffc7503807fa95e8840c012a80c83e4f3 (diff)
downloadbusybox-0c97c9d43707.tar.gz
busybox-0c97c9d43707.tar.bz2
'simple' error message functions by Loic Grenie <loic.grenie@gmail.com>.
263 bytes saved.
Diffstat (limited to 'libbb')
-rw-r--r--libbb/change_identity.c2
-rw-r--r--libbb/dump.c8
-rw-r--r--libbb/perror_msg.c5
-rw-r--r--libbb/perror_msg_and_die.c5
-rw-r--r--libbb/recursive_action.c2
-rw-r--r--libbb/vfork_daemon_rexec.c2
-rw-r--r--libbb/wfopen.c2
-rw-r--r--libbb/xfuncs.c4
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)
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 0d1bb18f2..829050d69 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 a958cff00..af9ff5949 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 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, ...)
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 cb3b88d1d..37363bb3e 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 558510bc6..80c72f165 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 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)
{
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 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)
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)