[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: Remove common patterns -- second try
From: "=?ISO-8859-1?Q?Lo=EFc_Greni=E9?=" <loic.grenie () gmail ! com>
Date: 2007-09-30 18:53:05
Message-ID: 9b06e8d20709301153p1bc3cf10jca4315701eb0a42a () mail ! gmail ! com
[Download RAW message or body]
2007/9/30, Denys Vlasenko <vda.linux@googlemail.com>:
> On Sunday 30 September 2007 15:30, Lo=EFc Greni=E9 wrote:
> > I've tried to remove "common patterns" in the code.
> > Second try: I've changed bb_\(p?\)error_msg\(_and_die\)("%s", \(.*\))
> > in bb_simple_\1error_msg\2(\3).
> >
> > Patch attached.
> >
> > Lo=EFc
> -#ifdef VERSION_WITH_WRITEV
> -.....
> -#endif
>
>
> Why did you remove it?
I had moved it in bb_simple_error_msg.c -- I've moved it back to where
it belonged.
> May I suggest a simpler approach?
>
> Make bb_simple_[p]error_msg_XXX(str) call bb_[p]error_msg_XXX("%s", str),
> not the other way around.
Of course, you're right.
While I'm at it: bb_verror_msg is written in such a way that msg can ha=
ve
an embedded NUL char. Is it important ? Otherwise the function can be
simplified (using strcat or vasprintf instead of moving pointers around).
Lo=EFc
PS: with my local gcc, whenever bb_simple_perror_msg is declared in
networking/libiproute/iproute.c, the function do_iproute takes 40 bytes
more. I've removed from the patch the kludge that I've used here but
I don't know whether this is a general problem.
["simple_error.diff" (text/x-patch)]
Index: networking/inetd.c
===================================================================
--- networking/inetd.c (révision 20150)
+++ networking/inetd.c (copie de travail)
@@ -983,7 +983,7 @@
char protoname[10];
if (!setconfig()) {
- bb_perror_msg("%s", config_filename);
+ bb_simple_perror_msg(config_filename);
return;
}
for (sep = servtab; sep; sep = sep->se_next)
Index: networking/netstat.c
===================================================================
--- networking/netstat.c (révision 20150)
+++ networking/netstat.c (copie de travail)
@@ -464,7 +464,7 @@
procinfo = fopen(file, "r");
if (procinfo == NULL) {
if (errno != ENOENT) {
- bb_perror_msg("%s", file);
+ bb_simple_perror_msg(file);
} else {
bb_error_msg("no support for '%s' on this system", name);
}
Index: networking/httpd.c
===================================================================
--- networking/httpd.c (révision 20150)
+++ networking/httpd.c (copie de travail)
@@ -504,7 +504,7 @@
return;
}
if (configFile && flag == FIRST_PARSE) /* if -c option given */
- bb_perror_msg_and_die("%s", cf);
+ bb_simple_perror_msg_and_die(cf);
flag = FIND_FROM_HTTPD_ROOT;
cf = httpd_conf;
}
Index: archival/bbunzip.c
===================================================================
--- archival/bbunzip.c (révision 20150)
+++ archival/bbunzip.c (copie de travail)
@@ -49,7 +49,7 @@
/* Open src */
if (filename) {
if (stat(filename, &stat_buf) != 0) {
- bb_perror_msg("%s", filename);
+ bb_simple_perror_msg(filename);
err:
exitcode = 1;
goto free_name;
Index: modutils/rmmod.c
===================================================================
--- modutils/rmmod.c (révision 20150)
+++ modutils/rmmod.c (copie de travail)
@@ -85,7 +85,7 @@
}
if (syscall(__NR_delete_module, ENABLE_FEATURE_2_6_MODULES ? misc_buf : argv[n], flags)) {
- bb_perror_msg("%s", argv[n]);
+ bb_simple_perror_msg(argv[n]);
ret = EXIT_FAILURE;
}
}
Index: shell/lash.c
===================================================================
--- shell/lash.c (révision 20150)
+++ shell/lash.c (copie de travail)
@@ -1159,7 +1159,7 @@
/* Do not use bb_perror_msg_and_die() here, since we must not
* call exit() but should call _exit() instead */
- bb_perror_msg("%s", child->argv[0]);
+ bb_simple_perror_msg(child->argv[0]);
_exit(EXIT_FAILURE);
}
Index: coreutils/wc.c
===================================================================
--- coreutils/wc.c (révision 20150)
+++ coreutils/wc.c (copie de travail)
@@ -150,7 +150,7 @@
}
} else if (c == EOF) {
if (ferror(fp)) {
- bb_perror_msg("%s", arg);
+ bb_simple_perror_msg(arg);
status = EXIT_FAILURE;
}
--counts[WC_CHARS];
Index: coreutils/nice.c
===================================================================
--- coreutils/nice.c (révision 20150)
+++ coreutils/nice.c (copie de travail)
@@ -51,5 +51,5 @@
/* The exec failed... */
xfunc_error_retval = (errno == ENOENT) ? 127 : 126; /* SUSv3 */
- bb_perror_msg_and_die("%s", *argv);
+ bb_simple_perror_msg_and_die(*argv);
}
Index: coreutils/dd.c
===================================================================
--- coreutils/dd.c (révision 20150)
+++ coreutils/dd.c (copie de travail)
@@ -278,7 +278,7 @@
if (n < 0) {
if (flags & FLAG_NOERROR) {
n = ibs;
- bb_perror_msg("%s", infile);
+ bb_simple_perror_msg(infile);
} else
goto die_infile;
}
@@ -320,12 +320,12 @@
}
if (close(ifd) < 0) {
die_infile:
- bb_perror_msg_and_die("%s", infile);
+ bb_simple_perror_msg_and_die(infile);
}
if (close(ofd) < 0) {
die_outfile:
- bb_perror_msg_and_die("%s", outfile);
+ bb_simple_perror_msg_and_die(outfile);
}
out_status:
dd_output_status(0);
Index: coreutils/df.c
===================================================================
--- coreutils/df.c (révision 20150)
+++ coreutils/df.c (copie de travail)
@@ -100,7 +100,7 @@
mount_point = mount_entry->mnt_dir;
if (statfs(mount_point, &s) != 0) {
- bb_perror_msg("%s", mount_point);
+ bb_simple_perror_msg(mount_point);
goto SET_ERROR;
}
Index: coreutils/split.c
===================================================================
--- coreutils/split.c (révision 20150)
+++ coreutils/split.c (copie de travail)
@@ -104,7 +104,7 @@
if (!bytes_read)
break;
if (bytes_read < 0)
- bb_perror_msg_and_die("%s", argv[0]);
+ bb_simple_perror_msg_and_die(argv[0]);
src = read_buffer;
do {
if (!remaining) {
Index: coreutils/mknod.c
===================================================================
--- coreutils/mknod.c (révision 20150)
+++ coreutils/mknod.c (copie de travail)
@@ -44,7 +44,7 @@
if (mknod(name, mode, dev) == 0) {
return EXIT_SUCCESS;
}
- bb_perror_msg_and_die("%s", name);
+ bb_simple_perror_msg_and_die(name);
}
}
bb_show_usage();
Index: coreutils/ln.c
===================================================================
--- coreutils/ln.c (révision 20150)
+++ coreutils/ln.c (copie de travail)
@@ -64,7 +64,7 @@
if (!(flag & LN_SYMLINK) && stat(*argv, &statbuf)) {
// coreutils: "ln dangling_symlink new_hardlink" works
if (lstat(*argv, &statbuf) || !S_ISLNK(statbuf.st_mode)) {
- bb_perror_msg("%s", *argv);
+ bb_simple_perror_msg(*argv);
status = EXIT_FAILURE;
free(src_name);
continue;
@@ -75,7 +75,7 @@
char *backup;
backup = xasprintf("%s%s", src, suffix);
if (rename(src, backup) < 0 && errno != ENOENT) {
- bb_perror_msg("%s", src);
+ bb_simple_perror_msg(src);
status = EXIT_FAILURE;
free(backup);
continue;
@@ -97,7 +97,7 @@
}
if (link_func(*argv, src) != 0) {
- bb_perror_msg("%s", src);
+ bb_simple_perror_msg(src);
status = EXIT_FAILURE;
}
Index: coreutils/mkfifo.c
===================================================================
--- coreutils/mkfifo.c (révision 20150)
+++ coreutils/mkfifo.c (copie de travail)
@@ -28,7 +28,7 @@
do {
if (mkfifo(*argv, mode) < 0) {
- bb_perror_msg("%s", *argv); /* Avoid multibyte problems. */
+ bb_simple_perror_msg(*argv); /* Avoid multibyte problems. */
retval = EXIT_FAILURE;
}
} while (*++argv);
Index: coreutils/fold.c
===================================================================
--- coreutils/fold.c (révision 20150)
+++ coreutils/fold.c (copie de travail)
@@ -145,7 +145,7 @@
}
if (ferror(istream) || fclose_if_not_stdin(istream)) {
- bb_perror_msg("%s", *argv); /* Avoid multibyte problems. */
+ bb_simple_perror_msg(*argv); /* Avoid multibyte problems. */
errs |= EXIT_FAILURE;
}
} while (*++argv);
Index: coreutils/nohup.c
===================================================================
--- coreutils/nohup.c (révision 20150)
+++ coreutils/nohup.c (copie de travail)
@@ -56,5 +56,5 @@
BB_EXECVP(argv[1], argv+1);
if (ENABLE_FEATURE_CLEAN_UP && home)
free((char*)nohupout);
- bb_perror_msg_and_die("%s", argv[1]);
+ bb_simple_perror_msg_and_die(argv[1]);
}
Index: coreutils/chmod.c
===================================================================
--- coreutils/chmod.c (révision 20150)
+++ coreutils/chmod.c (copie de travail)
@@ -63,7 +63,7 @@
}
err:
if (!OPT_QUIET)
- bb_perror_msg("%s", fileName);
+ bb_simple_perror_msg(fileName);
return FALSE;
}
Index: coreutils/realpath.c
===================================================================
--- coreutils/realpath.c (révision 20150)
+++ coreutils/realpath.c (copie de travail)
@@ -35,7 +35,7 @@
puts(resolved_path);
} else {
retval = EXIT_FAILURE;
- bb_perror_msg("%s", *argv);
+ bb_simple_perror_msg(*argv);
}
} while (--argc);
Index: coreutils/head.c
===================================================================
--- coreutils/head.c (révision 20150)
+++ coreutils/head.c (copie de travail)
@@ -128,7 +128,7 @@
putchar(c);
}
if (fclose_if_not_stdin(fp)) {
- bb_perror_msg("%s", *argv); /* Avoid multibyte problems. */
+ bb_simple_perror_msg(*argv); /* Avoid multibyte problems. */
retval = EXIT_FAILURE;
}
die_if_ferror_stdout();
Index: coreutils/chown.c
===================================================================
--- coreutils/chown.c (révision 20150)
+++ coreutils/chown.c (copie de travail)
@@ -57,7 +57,7 @@
return TRUE;
}
if (!OPT_QUIET)
- bb_perror_msg("%s", fileName); /* A filename can have % in it... */
+ bb_simple_perror_msg(fileName); /* A filename can have % in it... */
return FALSE;
}
Index: coreutils/env.c
===================================================================
--- coreutils/env.c (révision 20150)
+++ coreutils/env.c (copie de travail)
@@ -81,7 +81,7 @@
BB_EXECVP(*argv, argv);
/* SUSv3-mandated exit codes. */
xfunc_error_retval = (errno == ENOENT) ? 127 : 126;
- bb_perror_msg_and_die("%s", *argv);
+ bb_simple_perror_msg_and_die(*argv);
}
for (ep = environ; *ep; ep++) {
Index: coreutils/du.c
===================================================================
--- coreutils/du.c (révision 20150)
+++ coreutils/du.c (copie de travail)
@@ -67,7 +67,7 @@
unsigned long sum;
if (lstat(filename, &statbuf) != 0) {
- bb_perror_msg("%s", filename);
+ bb_simple_perror_msg(filename);
G.status = EXIT_FAILURE;
return 0;
}
@@ -85,7 +85,7 @@
if (S_ISLNK(statbuf.st_mode)) {
if (G.slink_depth > G.du_depth) { /* -H or -L */
if (stat(filename, &statbuf) != 0) {
- bb_perror_msg("%s", filename);
+ bb_simple_perror_msg(filename);
G.status = EXIT_FAILURE;
return 0;
}
Index: coreutils/ls.c
===================================================================
--- coreutils/ls.c (révision 20150)
+++ coreutils/ls.c (copie de travail)
@@ -171,7 +171,7 @@
}
#endif
if (stat(fullname, &dstat)) {
- bb_perror_msg("%s", fullname);
+ bb_simple_perror_msg(fullname);
status = EXIT_FAILURE;
return 0;
}
@@ -182,7 +182,7 @@
}
#endif
if (lstat(fullname, &dstat)) {
- bb_perror_msg("%s", fullname);
+ bb_simple_perror_msg(fullname);
status = EXIT_FAILURE;
return 0;
}
Index: coreutils/expand.c
===================================================================
--- coreutils/expand.c (révision 20150)
+++ coreutils/expand.c (copie de travail)
@@ -192,7 +192,7 @@
/* Check and close the file */
/* We do want all of them to execute, thus | instead of || */
if (ferror(file) | fclose_if_not_stdin(file)) {
- bb_perror_msg("%s", *argv);
+ bb_simple_perror_msg(*argv);
exit_status = EXIT_FAILURE;
}
/* If stdin also clear EOF */
Index: coreutils/touch.c
===================================================================
--- coreutils/touch.c (révision 20150)
+++ coreutils/touch.c (copie de travail)
@@ -49,7 +49,7 @@
}
}
status = EXIT_FAILURE;
- bb_perror_msg("%s", *argv);
+ bb_simple_perror_msg(*argv);
}
} while (*++argv);
Index: libbb/vfork_daemon_rexec.c
===================================================================
--- libbb/vfork_daemon_rexec.c (révision 20150)
+++ libbb/vfork_daemon_rexec.c (copie de travail)
@@ -62,7 +62,7 @@
{
pid_t pid = spawn(argv);
if (pid < 0)
- bb_perror_msg_and_die("%s", *argv);
+ bb_simple_perror_msg_and_die(*argv);
return pid;
}
Index: libbb/recursive_action.c
===================================================================
--- libbb/recursive_action.c (révision 20150)
+++ libbb/recursive_action.c (copie de travail)
@@ -120,6 +120,6 @@
return TRUE;
done_nak_warn:
- bb_perror_msg("%s", fileName);
+ bb_simple_perror_msg(fileName);
return FALSE;
}
Index: libbb/perror_msg_and_die.c
===================================================================
--- libbb/perror_msg_and_die.c (révision 20150)
+++ libbb/perror_msg_and_die.c (copie de travail)
@@ -19,3 +19,8 @@
va_end(p);
xfunc_die();
}
+
+void bb_simple_perror_msg_and_die(const char *s)
+{
+ bb_perror_msg_and_die("%s", s);
+}
Index: libbb/verror_msg.c
===================================================================
--- libbb/verror_msg.c (révision 20150)
+++ libbb/verror_msg.c (copie de travail)
@@ -15,8 +15,8 @@
void bb_verror_msg(const char *s, va_list p, const char* strerr)
{
- char *msg;
- int applet_len, strerr_len, msgeol_len, used;
+ char *msg, *msgend;
+ int applet_len, append_len, used;
if (!logmode)
return;
@@ -34,27 +34,26 @@
* children can produce log messages simultaneously. */
applet_len = strlen(applet_name) + 2; /* "applet: " */
- strerr_len = strerr ? strlen(strerr) : 0;
- msgeol_len = strlen(msg_eol);
- /* +3 is for ": " before strerr and for terminating NUL */
- msg = xrealloc(msg, applet_len + used + strerr_len + msgeol_len + 3);
+ append_len = (strerr ? strlen(strerr) + 2 : 0) + strlen(msg_eol);
+ /* +1 is for terminating NUL */
+ msg = xrealloc(msg, applet_len + used + append_len + 1);
/* TODO: maybe use writev instead of memmoving? Need full_writev? */
memmove(msg + applet_len, msg, used);
used += applet_len;
strcpy(msg, applet_name);
msg[applet_len - 2] = ':';
msg[applet_len - 1] = ' ';
+ msgend = &msg[used];
if (strerr) {
- msg[used++] = ':';
- msg[used++] = ' ';
- strcpy(&msg[used], strerr);
- used += strerr_len;
+ strcat(msgend, ": ");
+ strcat(msgend, strerr);
}
- strcpy(&msg[used], msg_eol);
+ strcat(msgend, msg_eol);
if (logmode & LOGMODE_STDIO) {
+ /* stdout or stderr (or both) ? */
fflush(stdout);
- full_write(2, msg, used + msgeol_len);
+ full_write(2, msg, used + append_len);
}
if (logmode & LOGMODE_SYSLOG) {
syslog(LOG_ERR, "%s", msg + applet_len);
@@ -62,7 +61,6 @@
free(msg);
}
-
#ifdef VERSION_WITH_WRITEV
/* Code size is approximately the same, but currently it's the only user
Index: libbb/wfopen.c
===================================================================
--- libbb/wfopen.c (révision 20150)
+++ libbb/wfopen.c (copie de travail)
@@ -13,7 +13,7 @@
{
FILE *fp = fopen(path, mode);
if (!fp) {
- bb_perror_msg("%s", path);
+ bb_simple_perror_msg(path);
errno = 0;
}
return fp;
Index: libbb/change_identity.c
===================================================================
--- libbb/change_identity.c (révision 20150)
+++ libbb/change_identity.c (copie de travail)
@@ -47,5 +47,5 @@
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);
}
Index: libbb/dump.c
===================================================================
--- libbb/dump.c (révision 20150)
+++ libbb/dump.c (copie de travail)
@@ -297,7 +297,7 @@
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 @@
}
}
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 @@
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 @@
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;
Index: libbb/xfuncs.c
===================================================================
--- libbb/xfuncs.c (révision 20150)
+++ libbb/xfuncs.c (copie de travail)
@@ -699,13 +699,13 @@
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)
Index: libbb/perror_msg.c
===================================================================
--- libbb/perror_msg.c (révision 20150)
+++ libbb/perror_msg.c (copie de travail)
@@ -18,3 +18,8 @@
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);
+}
Index: e2fsprogs/fsck.c
===================================================================
--- e2fsprogs/fsck.c (révision 20150)
+++ e2fsprogs/fsck.c (copie de travail)
@@ -659,7 +659,7 @@
if (!noexecute) {
pid = spawn(argv);
if (pid < 0)
- bb_perror_msg("%s", argv[0]);
+ bb_simple_perror_msg(argv[0]);
}
for (i = num_args+1; i < argc; i++)
Index: e2fsprogs/old_e2fsprogs/fsck.c
===================================================================
--- e2fsprogs/old_e2fsprogs/fsck.c (révision 20150)
+++ e2fsprogs/old_e2fsprogs/fsck.c (copie de travail)
@@ -626,7 +626,7 @@
if (!interactive)
close(0);
(void) execv(s, argv);
- bb_perror_msg_and_die("%s", argv[0]);
+ bb_simple_perror_msg_and_die(argv[0]);
}
for (i = 1; i < argc; i++)
Index: miscutils/chrt.c
===================================================================
--- miscutils/chrt.c (révision 20150)
+++ miscutils/chrt.c (copie de travail)
@@ -115,7 +115,7 @@
}
++argv;
BB_EXECVP(*argv, argv);
- bb_perror_msg_and_die("%s", *argv);
+ bb_simple_perror_msg_and_die(*argv);
}
#undef OPT_p
#undef OPT_r
Index: miscutils/mountpoint.c
===================================================================
--- miscutils/mountpoint.c (révision 20150)
+++ miscutils/mountpoint.c (copie de travail)
@@ -61,6 +61,6 @@
}
}
if (!(opt & OPT_q))
- bb_perror_msg("%s", arg);
+ bb_simple_perror_msg(arg);
return EXIT_FAILURE;
}
Index: miscutils/taskset.c
===================================================================
--- miscutils/taskset.c (révision 20150)
+++ miscutils/taskset.c (copie de travail)
@@ -92,7 +92,7 @@
}
++argv;
BB_EXECVP(*argv, argv);
- bb_perror_msg_and_die("%s", *argv);
+ bb_simple_perror_msg_and_die(*argv);
}
#undef OPT_p
#undef TASKSET_PRINTF_MASK
Index: miscutils/setsid.c
===================================================================
--- miscutils/setsid.c (révision 20150)
+++ miscutils/setsid.c (copie de travail)
@@ -29,5 +29,5 @@
setsid(); /* no error possible */
BB_EXECVP(argv[1], argv + 1);
- bb_perror_msg_and_die("%s", argv[1]);
+ bb_simple_perror_msg_and_die(argv[1]);
}
Index: include/libbb.h
===================================================================
--- include/libbb.h (révision 20150)
+++ include/libbb.h (copie de travail)
@@ -676,7 +676,9 @@
extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
+extern void bb_simple_perror_msg(const char *s);
extern void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
+extern void bb_simple_perror_msg_and_die(const char *s) __attribute__ ((noreturn));
extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
extern void bb_perror_nomsg_and_die(void) ATTRIBUTE_NORETURN;
@@ -1184,7 +1186,6 @@
#include <dmalloc.h>
#endif
-
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif /* __LIBBUSYBOX_H__ */
Index: selinux/setfiles.c
===================================================================
--- selinux/setfiles.c (révision 20150)
+++ selinux/setfiles.c (copie de travail)
@@ -595,7 +595,7 @@
if (argc == 1)
bb_show_usage();
if (stat(argv[optind], &sb) < 0) {
- bb_perror_msg_and_die("%s", argv[optind]);
+ bb_simple_perror_msg_and_die(argv[optind]);
}
if (!S_ISREG(sb.st_mode)) {
bb_error_msg_and_die("spec file %s is not a regular file", argv[optind]);
@@ -603,7 +603,7 @@
/* Load the file contexts configuration and check it. */
rc = matchpathcon_init(argv[optind]);
if (rc < 0) {
- bb_perror_msg_and_die("%s", argv[optind]);
+ bb_simple_perror_msg_and_die(argv[optind]);
}
optind++;
Index: loginutils/adduser.c
===================================================================
--- loginutils/adduser.c (révision 20150)
+++ loginutils/adduser.c (copie de travail)
@@ -144,7 +144,7 @@
if (mkdir(p->pw_dir, 0755)
|| chown(p->pw_dir, p->pw_uid, p->pw_gid)
|| chmod(p->pw_dir, 02755)) {
- bb_perror_msg("%s", p->pw_dir);
+ bb_simple_perror_msg(p->pw_dir);
}
}
Index: findutils/find.c
===================================================================
--- findutils/find.c (révision 20150)
+++ findutils/find.c (copie de travail)
@@ -277,7 +277,7 @@
rc = spawn_and_wait(argv);
if (rc < 0)
- bb_perror_msg("%s", argv[0]);
+ bb_simple_perror_msg(argv[0]);
i = 0;
while (argv[i])
@@ -347,7 +347,7 @@
rc = unlink(fileName);
}
if (rc < 0)
- bb_perror_msg("%s", fileName);
+ bb_simple_perror_msg(fileName);
return TRUE;
}
#endif
@@ -780,7 +780,7 @@
ap->context = NULL;
/* SELinux headers erroneously declare non-const parameter */
if (selinux_raw_to_trans_context((char*)arg1, &ap->context))
- bb_perror_msg("%s", arg1);
+ bb_simple_perror_msg(arg1);
}
#endif
else {
Index: findutils/xargs.c
===================================================================
--- findutils/xargs.c (révision 20150)
+++ findutils/xargs.c (copie de travail)
@@ -57,7 +57,7 @@
status = spawn_and_wait(args);
if (status < 0) {
- bb_perror_msg("%s", args[0]);
+ bb_simple_perror_msg(args[0]);
return errno == ENOENT ? 127 : 126;
}
if (status == 255) {
Index: findutils/grep.c
===================================================================
--- findutils/grep.c (révision 20150)
+++ findutils/grep.c (copie de travail)
@@ -369,7 +369,7 @@
FILE *file = fopen(filename, "r");
if (file == NULL) {
if (!SUPPRESS_ERR_MSGS)
- bb_perror_msg("%s", cur_file);
+ bb_simple_perror_msg(cur_file);
open_errors = 1;
return 0;
}
@@ -517,7 +517,7 @@
file = fopen(cur_file, "r");
if (file == NULL) {
if (!SUPPRESS_ERR_MSGS)
- bb_perror_msg("%s", cur_file);
+ bb_simple_perror_msg(cur_file);
open_errors = 1;
continue;
}
Index: init/mesg.c
===================================================================
--- init/mesg.c (révision 20150)
+++ init/mesg.c (copie de travail)
@@ -40,7 +40,7 @@
return EXIT_SUCCESS;
}
}
- bb_perror_msg_and_die("%s", tty);
+ bb_simple_perror_msg_and_die(tty);
}
bb_show_usage();
}
Index: applets/applets.c
===================================================================
--- applets/applets.c (révision 20150)
+++ applets/applets.c (copie de travail)
@@ -526,7 +526,7 @@
applets[i].name);
rc = lf(busybox, fpc);
if (rc != 0 && errno != EEXIST) {
- bb_perror_msg("%s", fpc);
+ bb_simple_perror_msg(fpc);
}
free(fpc);
}
Index: util-linux/swaponoff.c
===================================================================
--- util-linux/swaponoff.c (révision 20150)
+++ util-linux/swaponoff.c (copie de travail)
@@ -31,7 +31,7 @@
status = swapoff(device);
if (status != 0) {
- bb_perror_msg("%s", device);
+ bb_simple_perror_msg(device);
return 1;
}
Index: util-linux/setarch.c
===================================================================
--- util-linux/setarch.c (révision 20150)
+++ util-linux/setarch.c (copie de travail)
@@ -44,5 +44,5 @@
BB_EXECVP(argv[0], argv);
}
- bb_perror_msg_and_die("%s", argv[0]);
+ bb_simple_perror_msg_and_die(argv[0]);
}
Index: util-linux/mount.c
===================================================================
--- util-linux/mount.c (révision 20150)
+++ util-linux/mount.c (copie de travail)
@@ -1655,7 +1655,7 @@
&& (i & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
) {
rc = mount("", argv[0], "", i, "");
- if (rc) bb_perror_msg_and_die("%s", argv[0]);
+ if (rc) bb_simple_perror_msg_and_die(argv[0]);
goto clean_up;
}
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic