'simple' error message functions by Loic Grenie <loic.grenie@gmail.com>.

263 bytes saved.
This commit is contained in:
Denis Vlasenko
2007-10-01 11:58:38 +00:00
parent d65ea39ffc
commit 0c97c9d437
50 changed files with 73 additions and 62 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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)