aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-06-25 01:46:53 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-06-25 01:46:53 +0200
commit41ddd9f60604cd994eeb37eb5708e9d3d5c8484b (patch)
treea2c7b5e6ea0d26715bac8c1f9f4b4e1fbad22534
parent2b46fd49b14b2ac30e0c767c65ac2b29f6922a45 (diff)
downloadbusybox-41ddd9f60604cd994eeb37eb5708e9d3d5c8484b.tar.gz
*: make exec failure message more consistent
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--console-tools/openvt.c2
-rw-r--r--coreutils/chroot.c4
-rw-r--r--coreutils/env.c6
-rw-r--r--coreutils/nice.c5
-rw-r--r--coreutils/nohup.c5
-rw-r--r--debianutils/start_stop_daemon.c2
-rw-r--r--libbb/run_shell.c2
-rw-r--r--libbb/vfork_daemon_rexec.c2
-rw-r--r--mailutils/mail.c4
-rw-r--r--mailutils/mime.c4
-rw-r--r--miscutils/chrt.c6
-rw-r--r--miscutils/ionice.c6
-rw-r--r--miscutils/setsid.c5
-rw-r--r--miscutils/taskset.c6
-rw-r--r--miscutils/time.c2
-rw-r--r--miscutils/timeout.c2
-rw-r--r--networking/httpd.c2
-rw-r--r--networking/ifupdown.c2
-rw-r--r--networking/inetd.c2
-rw-r--r--networking/nc_bloaty.c2
-rw-r--r--networking/tcpudp.c2
-rw-r--r--printutils/lpd.c4
-rw-r--r--runit/chpst.c2
-rw-r--r--selinux/runcon.c1
24 files changed, 40 insertions, 40 deletions
diff --git a/console-tools/openvt.c b/console-tools/openvt.c
index 7bd6072a4..6f58916e7 100644
--- a/console-tools/openvt.c
+++ b/console-tools/openvt.c
@@ -98,7 +98,7 @@ static NOINLINE void vfork_child(char **argv)
//bb_error_msg("VT's sid %d", tcgetsid(0));
//bb_error_msg("VT's pgrp %d", tcgetpgrp(0));
BB_EXECVP(argv[0], argv);
- bb_perror_msg_and_die("exec %s", argv[0]);
+ bb_perror_msg_and_die("can't execute '%s'", argv[0]);
}
}
diff --git a/coreutils/chroot.c b/coreutils/chroot.c
index f7228a61a..bc0b1f82c 100644
--- a/coreutils/chroot.c
+++ b/coreutils/chroot.c
@@ -30,6 +30,6 @@ int chroot_main(int argc UNUSED_PARAM, char **argv)
argv[1] = (char *) "-i";
}
- BB_EXECVP(*argv, argv);
- bb_perror_msg_and_die("can't execute '%s'", *argv);
+ BB_EXECVP(argv[0], argv);
+ bb_perror_msg_and_die("can't execute '%s'", argv[0]);
}
diff --git a/coreutils/env.c b/coreutils/env.c
index 9635d2b22..c6ba04d35 100644
--- a/coreutils/env.c
+++ b/coreutils/env.c
@@ -76,11 +76,11 @@ int env_main(int argc UNUSED_PARAM, char **argv)
++argv;
}
- if (*argv) {
- BB_EXECVP(*argv, argv);
+ if (argv[0]) {
+ BB_EXECVP(argv[0], argv);
/* SUSv3-mandated exit codes. */
xfunc_error_retval = (errno == ENOENT) ? 127 : 126;
- bb_simple_perror_msg_and_die(*argv);
+ bb_perror_msg_and_die("can't execute '%s'", argv[0]);
}
if (environ) { /* clearenv() may set environ == NULL! */
diff --git a/coreutils/nice.c b/coreutils/nice.c
index d24a95b45..0f70f1079 100644
--- a/coreutils/nice.c
+++ b/coreutils/nice.c
@@ -47,9 +47,8 @@ int nice_main(int argc, char **argv)
}
}
- BB_EXECVP(*argv, argv); /* Now exec the desired program. */
-
+ BB_EXECVP(argv[0], argv);
/* The exec failed... */
xfunc_error_retval = (errno == ENOENT) ? 127 : 126; /* SUSv3 */
- bb_simple_perror_msg_and_die(*argv);
+ bb_perror_msg_and_die("can't execute '%s'", argv[0]);
}
diff --git a/coreutils/nohup.c b/coreutils/nohup.c
index 4f6385f8e..1027ada1c 100644
--- a/coreutils/nohup.c
+++ b/coreutils/nohup.c
@@ -75,6 +75,7 @@ int nohup_main(int argc UNUSED_PARAM, char **argv)
signal(SIGHUP, SIG_IGN);
- BB_EXECVP(argv[1], argv+1);
- bb_simple_perror_msg_and_die(argv[1]);
+ argv++;
+ BB_EXECVP(argv[0], argv);
+ bb_perror_msg_and_die("can't execute '%s'", argv[0]);
}
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c
index 0a0802575..3ded758bf 100644
--- a/debianutils/start_stop_daemon.c
+++ b/debianutils/start_stop_daemon.c
@@ -448,5 +448,5 @@ int start_stop_daemon_main(int argc UNUSED_PARAM, char **argv)
}
#endif
execvp(startas, argv);
- bb_perror_msg_and_die("can't start %s", startas);
+ bb_perror_msg_and_die("can't execute '%s'", startas);
}
diff --git a/libbb/run_shell.c b/libbb/run_shell.c
index 6f98bd695..4608a24a9 100644
--- a/libbb/run_shell.c
+++ b/libbb/run_shell.c
@@ -86,5 +86,5 @@ void FAST_FUNC run_shell(const char *shell, int loginshell, const char *command,
freecon(current_sid);
#endif
execv(shell, (char **) args);
- bb_perror_msg_and_die("can't run '%s'", shell);
+ bb_perror_msg_and_die("can't execute '%s'", shell);
}
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
index 07024f5f0..082f0f63e 100644
--- a/libbb/vfork_daemon_rexec.c
+++ b/libbb/vfork_daemon_rexec.c
@@ -249,7 +249,7 @@ void FAST_FUNC re_exec(char **argv)
* "we have (already) re-execed, don't do it again" flag */
argv[0][0] |= 0x80;
execv(bb_busybox_exec_path, argv);
- bb_perror_msg_and_die("exec %s", bb_busybox_exec_path);
+ bb_perror_msg_and_die("can't execute '%s'", bb_busybox_exec_path);
}
pid_t FAST_FUNC fork_or_rexec(char **argv)
diff --git a/mailutils/mail.c b/mailutils/mail.c
index 64a5b996f..49e72c32b 100644
--- a/mailutils/mail.c
+++ b/mailutils/mail.c
@@ -67,8 +67,8 @@ void FAST_FUNC launch_helper(const char **argv)
if (!G.helper_pid) {
// child: try to execute connection helper
// NB: SIGCHLD & SIGALRM revert to SIG_DFL on exec
- BB_EXECVP(*argv, (char **)argv);
- _exit(127);
+ BB_EXECVP(argv[0], (char **)argv);
+ bb_perror_msg_and_die("can't execute '%s'", argv[0]);
}
// parent
diff --git a/mailutils/mime.c b/mailutils/mime.c
index ee147802e..654b8731c 100644
--- a/mailutils/mime.c
+++ b/mailutils/mime.c
@@ -288,8 +288,8 @@ static int parse(const char *boundary, char **argv)
xsetenv("CHARSET", charset);
xsetenv("ENCODING", encoding);
xsetenv("FILENAME", filename);
- BB_EXECVP(*argv, argv);
- _exit(EXIT_FAILURE);
+ BB_EXECVP(argv[0], argv);
+ bb_perror_msg_and_die("can't execute '%s'", argv[0]);
}
// parent dumps to fd[1]
close(fd[0]);
diff --git a/miscutils/chrt.c b/miscutils/chrt.c
index cc5660be7..e2b7f8ae0 100644
--- a/miscutils/chrt.c
+++ b/miscutils/chrt.c
@@ -115,9 +115,9 @@ int chrt_main(int argc UNUSED_PARAM, char **argv)
if (sched_setscheduler(pid, policy, &sp) < 0)
bb_perror_msg_and_die("can't %cet pid %d's policy", 's', pid);
- if (!*argv) /* "-p <priority> <pid> [...]" */
+ if (!argv[0]) /* "-p <priority> <pid> [...]" */
goto print_rt_info;
- BB_EXECVP(*argv, argv);
- bb_simple_perror_msg_and_die(*argv);
+ BB_EXECVP(argv[0], argv);
+ bb_perror_msg_and_die("can't execute '%s'", argv[0]);
}
diff --git a/miscutils/ionice.c b/miscutils/ionice.c
index 361c141b8..8393cd8b2 100644
--- a/miscutils/ionice.c
+++ b/miscutils/ionice.c
@@ -89,9 +89,9 @@ int ionice_main(int argc UNUSED_PARAM, char **argv)
pri |= (ioclass << IOPRIO_CLASS_SHIFT);
if (ioprio_set(IOPRIO_WHO_PROCESS, pid, pri) == -1)
bb_perror_msg_and_die("ioprio_%cet", 's');
- if (*argv) {
- BB_EXECVP(*argv, argv);
- bb_simple_perror_msg_and_die(*argv);
+ if (argv[0]) {
+ BB_EXECVP(argv[0], argv);
+ bb_perror_msg_and_die("can't execute '%s'", argv[0]);
}
}
diff --git a/miscutils/setsid.c b/miscutils/setsid.c
index fd3283e30..60ee062e3 100644
--- a/miscutils/setsid.c
+++ b/miscutils/setsid.c
@@ -44,6 +44,7 @@ int setsid_main(int argc UNUSED_PARAM, char **argv)
setsid();
}
- BB_EXECVP(argv[1], argv + 1);
- bb_simple_perror_msg_and_die(argv[1]);
+ argv++;
+ BB_EXECVP(argv[0], argv);
+ bb_perror_msg_and_die("can't execute '%s'", argv[0]);
}
diff --git a/miscutils/taskset.c b/miscutils/taskset.c
index a0bbf0aa1..2891003df 100644
--- a/miscutils/taskset.c
+++ b/miscutils/taskset.c
@@ -129,9 +129,9 @@ int taskset_main(int argc UNUSED_PARAM, char **argv)
if (sched_setaffinity(pid, sizeof(mask), &mask))
bb_perror_msg_and_die("can't %cet pid %d's affinity", 's', pid);
- if (!*argv) /* "-p <aff> <pid> [...ignored...]" */
+ if (!argv[0]) /* "-p <aff> <pid> [...ignored...]" */
goto print_aff; /* print new affinity and exit */
- BB_EXECVP(*argv, argv);
- bb_simple_perror_msg_and_die(*argv);
+ BB_EXECVP(argv[0], argv);
+ bb_perror_msg_and_die("can't execute '%s'", argv[0]);
}
diff --git a/miscutils/time.c b/miscutils/time.c
index 6946c863f..f5d1e15fb 100644
--- a/miscutils/time.c
+++ b/miscutils/time.c
@@ -380,7 +380,7 @@ static void run_command(char *const *cmd, resource_t *resp)
versus merely warnings if the cast is left off. */
BB_EXECVP(cmd[0], cmd);
xfunc_error_retval = (errno == ENOENT ? 127 : 126);
- bb_error_msg_and_die("can't run '%s'", cmd[0]);
+ bb_perror_msg_and_die("can't execute '%s'", cmd[0]);
}
/* Have signals kill the child but not self (if possible). */
diff --git a/miscutils/timeout.c b/miscutils/timeout.c
index 83ae56e69..273d26953 100644
--- a/miscutils/timeout.c
+++ b/miscutils/timeout.c
@@ -111,5 +111,5 @@ int timeout_main(int argc UNUSED_PARAM, char **argv)
argv[1] = sv2;
#endif
BB_EXECVP(argv[0], argv);
- bb_perror_msg_and_die("exec '%s'", argv[0]);
+ bb_perror_msg_and_die("can't execute '%s'", argv[0]);
}
diff --git a/networking/httpd.c b/networking/httpd.c
index 6dbc219e7..bab7b99cb 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -1474,7 +1474,7 @@ static void send_cgi_and_exit(
* in the current directory */
execv(argv[0], argv);
if (verbose)
- bb_perror_msg("exec %s", argv[0]);
+ bb_perror_msg_and_die("can't execute '%s'", argv[0]);
error_execing_cgi:
/* send to stdout
* (we are CGI here, our stdout is pumped to the net) */
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 2f3dd1d7b..714d2a107 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -1053,7 +1053,7 @@ static int popen2(FILE **in, FILE **out, char *command, char *param)
xmove_fd(infd.rd, 0);
xmove_fd(outfd.wr, 1);
BB_EXECVP(command, argv);
- _exit(127);
+ bb_perror_msg_and_die("can't execute '%s'", command);
}
/* parent */
close(infd.rd);
diff --git a/networking/inetd.c b/networking/inetd.c
index 7aa6b7b19..6d21e18f5 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -1380,7 +1380,7 @@ int inetd_main(int argc UNUSED_PARAM, char **argv)
sigaction_set(SIGPIPE, &saved_pipe_handler);
restore_sigmask(&omask);
BB_EXECVP(sep->se_program, sep->se_argv);
- bb_perror_msg("exec %s", sep->se_program);
+ bb_perror_msg_and_die("can't execute '%s'", sep->se_program);
do_exit1:
/* eat packet in udp case */
if (sep->se_socktype != SOCK_STREAM)
diff --git a/networking/nc_bloaty.c b/networking/nc_bloaty.c
index e14d512ed..8d27e9682 100644
--- a/networking/nc_bloaty.c
+++ b/networking/nc_bloaty.c
@@ -230,7 +230,7 @@ static int doexec(char **proggie)
/* dup2(0, 2); - do we *really* want this? NO!
* exec'ed prog can do it yourself, if needed */
execvp(proggie[0], proggie);
- bb_perror_msg_and_die("exec");
+ bb_perror_msg_and_die("can't execute '%s'", proggie[0]);
}
/* connect_w_timeout:
diff --git a/networking/tcpudp.c b/networking/tcpudp.c
index b32fad624..4e4756738 100644
--- a/networking/tcpudp.c
+++ b/networking/tcpudp.c
@@ -504,7 +504,7 @@ int tcpudpsvd_main(int argc UNUSED_PARAM, char **argv)
#else
BB_EXECVP(argv[0], argv);
#endif
- bb_perror_msg_and_die("exec '%s'", argv[0]);
+ bb_perror_msg_and_die("can't execute '%s'", argv[0]);
}
/*
diff --git a/printutils/lpd.c b/printutils/lpd.c
index 43c22948f..15f1ba20b 100644
--- a/printutils/lpd.c
+++ b/printutils/lpd.c
@@ -181,8 +181,8 @@ int lpd_main(int argc UNUSED_PARAM, char *argv[])
// this call reopens stdio fds to "/dev/null"
// (no daemonization is done)
bb_daemonize_or_rexec(DAEMON_DEVNULL_STDIO | DAEMON_ONLY_SANITIZE, NULL);
- BB_EXECVP(*argv, argv);
- exit(127);
+ BB_EXECVP(argv[0], argv);
+ bb_perror_msg_and_die("can't execute '%s'", argv[0]);
}
// validate input.
diff --git a/runit/chpst.c b/runit/chpst.c
index 1a68eb755..028a28d6c 100644
--- a/runit/chpst.c
+++ b/runit/chpst.c
@@ -383,5 +383,5 @@ int chpst_main(int argc UNUSED_PARAM, char **argv)
close(STDERR_FILENO);
BB_EXECVP(argv[0], argv);
- bb_perror_msg_and_die("exec %s", argv[0]);
+ bb_perror_msg_and_die("can't execute '%s'", argv[0]);
}
diff --git a/selinux/runcon.c b/selinux/runcon.c
index 4afd1116e..f8ca9a6aa 100644
--- a/selinux/runcon.c
+++ b/selinux/runcon.c
@@ -133,6 +133,5 @@ int runcon_main(int argc UNUSED_PARAM, char **argv)
context_str(con));
execvp(argv[0], argv);
-
bb_perror_msg_and_die("can't execute '%s'", argv[0]);
}