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-w32-41ddd9f60604cd994eeb37eb5708e9d3d5c8484b.tar.gz
busybox-w32-41ddd9f60604cd994eeb37eb5708e9d3d5c8484b.tar.bz2
busybox-w32-41ddd9f60604cd994eeb37eb5708e9d3d5c8484b.zip
*: 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)
98 //bb_error_msg("VT's sid %d", tcgetsid(0)); 98 //bb_error_msg("VT's sid %d", tcgetsid(0));
99 //bb_error_msg("VT's pgrp %d", tcgetpgrp(0)); 99 //bb_error_msg("VT's pgrp %d", tcgetpgrp(0));
100 BB_EXECVP(argv[0], argv); 100 BB_EXECVP(argv[0], argv);
101 bb_perror_msg_and_die("exec %s", argv[0]); 101 bb_perror_msg_and_die("can't execute '%s'", argv[0]);
102 } 102 }
103} 103}
104 104
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)
30 argv[1] = (char *) "-i"; 30 argv[1] = (char *) "-i";
31 } 31 }
32 32
33 BB_EXECVP(*argv, argv); 33 BB_EXECVP(argv[0], argv);
34 bb_perror_msg_and_die("can't execute '%s'", *argv); 34 bb_perror_msg_and_die("can't execute '%s'", argv[0]);
35} 35}
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)
76 ++argv; 76 ++argv;
77 } 77 }
78 78
79 if (*argv) { 79 if (argv[0]) {
80 BB_EXECVP(*argv, argv); 80 BB_EXECVP(argv[0], argv);
81 /* SUSv3-mandated exit codes. */ 81 /* SUSv3-mandated exit codes. */
82 xfunc_error_retval = (errno == ENOENT) ? 127 : 126; 82 xfunc_error_retval = (errno == ENOENT) ? 127 : 126;
83 bb_simple_perror_msg_and_die(*argv); 83 bb_perror_msg_and_die("can't execute '%s'", argv[0]);
84 } 84 }
85 85
86 if (environ) { /* clearenv() may set environ == NULL! */ 86 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)
47 } 47 }
48 } 48 }
49 49
50 BB_EXECVP(*argv, argv); /* Now exec the desired program. */ 50 BB_EXECVP(argv[0], argv);
51
52 /* The exec failed... */ 51 /* The exec failed... */
53 xfunc_error_retval = (errno == ENOENT) ? 127 : 126; /* SUSv3 */ 52 xfunc_error_retval = (errno == ENOENT) ? 127 : 126; /* SUSv3 */
54 bb_simple_perror_msg_and_die(*argv); 53 bb_perror_msg_and_die("can't execute '%s'", argv[0]);
55} 54}
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)
75 75
76 signal(SIGHUP, SIG_IGN); 76 signal(SIGHUP, SIG_IGN);
77 77
78 BB_EXECVP(argv[1], argv+1); 78 argv++;
79 bb_simple_perror_msg_and_die(argv[1]); 79 BB_EXECVP(argv[0], argv);
80 bb_perror_msg_and_die("can't execute '%s'", argv[0]);
80} 81}
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)
448 } 448 }
449#endif 449#endif
450 execvp(startas, argv); 450 execvp(startas, argv);
451 bb_perror_msg_and_die("can't start %s", startas); 451 bb_perror_msg_and_die("can't execute '%s'", startas);
452} 452}
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,
86 freecon(current_sid); 86 freecon(current_sid);
87#endif 87#endif
88 execv(shell, (char **) args); 88 execv(shell, (char **) args);
89 bb_perror_msg_and_die("can't run '%s'", shell); 89 bb_perror_msg_and_die("can't execute '%s'", shell);
90} 90}
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)
249 * "we have (already) re-execed, don't do it again" flag */ 249 * "we have (already) re-execed, don't do it again" flag */
250 argv[0][0] |= 0x80; 250 argv[0][0] |= 0x80;
251 execv(bb_busybox_exec_path, argv); 251 execv(bb_busybox_exec_path, argv);
252 bb_perror_msg_and_die("exec %s", bb_busybox_exec_path); 252 bb_perror_msg_and_die("can't execute '%s'", bb_busybox_exec_path);
253} 253}
254 254
255pid_t FAST_FUNC fork_or_rexec(char **argv) 255pid_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)
67 if (!G.helper_pid) { 67 if (!G.helper_pid) {
68 // child: try to execute connection helper 68 // child: try to execute connection helper
69 // NB: SIGCHLD & SIGALRM revert to SIG_DFL on exec 69 // NB: SIGCHLD & SIGALRM revert to SIG_DFL on exec
70 BB_EXECVP(*argv, (char **)argv); 70 BB_EXECVP(argv[0], (char **)argv);
71 _exit(127); 71 bb_perror_msg_and_die("can't execute '%s'", argv[0]);
72 } 72 }
73 73
74 // parent 74 // 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)
288 xsetenv("CHARSET", charset); 288 xsetenv("CHARSET", charset);
289 xsetenv("ENCODING", encoding); 289 xsetenv("ENCODING", encoding);
290 xsetenv("FILENAME", filename); 290 xsetenv("FILENAME", filename);
291 BB_EXECVP(*argv, argv); 291 BB_EXECVP(argv[0], argv);
292 _exit(EXIT_FAILURE); 292 bb_perror_msg_and_die("can't execute '%s'", argv[0]);
293 } 293 }
294 // parent dumps to fd[1] 294 // parent dumps to fd[1]
295 close(fd[0]); 295 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)
115 if (sched_setscheduler(pid, policy, &sp) < 0) 115 if (sched_setscheduler(pid, policy, &sp) < 0)
116 bb_perror_msg_and_die("can't %cet pid %d's policy", 's', pid); 116 bb_perror_msg_and_die("can't %cet pid %d's policy", 's', pid);
117 117
118 if (!*argv) /* "-p <priority> <pid> [...]" */ 118 if (!argv[0]) /* "-p <priority> <pid> [...]" */
119 goto print_rt_info; 119 goto print_rt_info;
120 120
121 BB_EXECVP(*argv, argv); 121 BB_EXECVP(argv[0], argv);
122 bb_simple_perror_msg_and_die(*argv); 122 bb_perror_msg_and_die("can't execute '%s'", argv[0]);
123} 123}
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)
89 pri |= (ioclass << IOPRIO_CLASS_SHIFT); 89 pri |= (ioclass << IOPRIO_CLASS_SHIFT);
90 if (ioprio_set(IOPRIO_WHO_PROCESS, pid, pri) == -1) 90 if (ioprio_set(IOPRIO_WHO_PROCESS, pid, pri) == -1)
91 bb_perror_msg_and_die("ioprio_%cet", 's'); 91 bb_perror_msg_and_die("ioprio_%cet", 's');
92 if (*argv) { 92 if (argv[0]) {
93 BB_EXECVP(*argv, argv); 93 BB_EXECVP(argv[0], argv);
94 bb_simple_perror_msg_and_die(*argv); 94 bb_perror_msg_and_die("can't execute '%s'", argv[0]);
95 } 95 }
96 } 96 }
97 97
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)
44 setsid(); 44 setsid();
45 } 45 }
46 46
47 BB_EXECVP(argv[1], argv + 1); 47 argv++;
48 bb_simple_perror_msg_and_die(argv[1]); 48 BB_EXECVP(argv[0], argv);
49 bb_perror_msg_and_die("can't execute '%s'", argv[0]);
49} 50}
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)
129 if (sched_setaffinity(pid, sizeof(mask), &mask)) 129 if (sched_setaffinity(pid, sizeof(mask), &mask))
130 bb_perror_msg_and_die("can't %cet pid %d's affinity", 's', pid); 130 bb_perror_msg_and_die("can't %cet pid %d's affinity", 's', pid);
131 131
132 if (!*argv) /* "-p <aff> <pid> [...ignored...]" */ 132 if (!argv[0]) /* "-p <aff> <pid> [...ignored...]" */
133 goto print_aff; /* print new affinity and exit */ 133 goto print_aff; /* print new affinity and exit */
134 134
135 BB_EXECVP(*argv, argv); 135 BB_EXECVP(argv[0], argv);
136 bb_simple_perror_msg_and_die(*argv); 136 bb_perror_msg_and_die("can't execute '%s'", argv[0]);
137} 137}
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)
380 versus merely warnings if the cast is left off. */ 380 versus merely warnings if the cast is left off. */
381 BB_EXECVP(cmd[0], cmd); 381 BB_EXECVP(cmd[0], cmd);
382 xfunc_error_retval = (errno == ENOENT ? 127 : 126); 382 xfunc_error_retval = (errno == ENOENT ? 127 : 126);
383 bb_error_msg_and_die("can't run '%s'", cmd[0]); 383 bb_perror_msg_and_die("can't execute '%s'", cmd[0]);
384 } 384 }
385 385
386 /* Have signals kill the child but not self (if possible). */ 386 /* 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)
111 argv[1] = sv2; 111 argv[1] = sv2;
112#endif 112#endif
113 BB_EXECVP(argv[0], argv); 113 BB_EXECVP(argv[0], argv);
114 bb_perror_msg_and_die("exec '%s'", argv[0]); 114 bb_perror_msg_and_die("can't execute '%s'", argv[0]);
115} 115}
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(
1474 * in the current directory */ 1474 * in the current directory */
1475 execv(argv[0], argv); 1475 execv(argv[0], argv);
1476 if (verbose) 1476 if (verbose)
1477 bb_perror_msg("exec %s", argv[0]); 1477 bb_perror_msg_and_die("can't execute '%s'", argv[0]);
1478 error_execing_cgi: 1478 error_execing_cgi:
1479 /* send to stdout 1479 /* send to stdout
1480 * (we are CGI here, our stdout is pumped to the net) */ 1480 * (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)
1053 xmove_fd(infd.rd, 0); 1053 xmove_fd(infd.rd, 0);
1054 xmove_fd(outfd.wr, 1); 1054 xmove_fd(outfd.wr, 1);
1055 BB_EXECVP(command, argv); 1055 BB_EXECVP(command, argv);
1056 _exit(127); 1056 bb_perror_msg_and_die("can't execute '%s'", command);
1057 } 1057 }
1058 /* parent */ 1058 /* parent */
1059 close(infd.rd); 1059 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)
1380 sigaction_set(SIGPIPE, &saved_pipe_handler); 1380 sigaction_set(SIGPIPE, &saved_pipe_handler);
1381 restore_sigmask(&omask); 1381 restore_sigmask(&omask);
1382 BB_EXECVP(sep->se_program, sep->se_argv); 1382 BB_EXECVP(sep->se_program, sep->se_argv);
1383 bb_perror_msg("exec %s", sep->se_program); 1383 bb_perror_msg_and_die("can't execute '%s'", sep->se_program);
1384 do_exit1: 1384 do_exit1:
1385 /* eat packet in udp case */ 1385 /* eat packet in udp case */
1386 if (sep->se_socktype != SOCK_STREAM) 1386 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)
230 /* dup2(0, 2); - do we *really* want this? NO! 230 /* dup2(0, 2); - do we *really* want this? NO!
231 * exec'ed prog can do it yourself, if needed */ 231 * exec'ed prog can do it yourself, if needed */
232 execvp(proggie[0], proggie); 232 execvp(proggie[0], proggie);
233 bb_perror_msg_and_die("exec"); 233 bb_perror_msg_and_die("can't execute '%s'", proggie[0]);
234} 234}
235 235
236/* connect_w_timeout: 236/* 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)
504#else 504#else
505 BB_EXECVP(argv[0], argv); 505 BB_EXECVP(argv[0], argv);
506#endif 506#endif
507 bb_perror_msg_and_die("exec '%s'", argv[0]); 507 bb_perror_msg_and_die("can't execute '%s'", argv[0]);
508} 508}
509 509
510/* 510/*
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[])
181 // this call reopens stdio fds to "/dev/null" 181 // this call reopens stdio fds to "/dev/null"
182 // (no daemonization is done) 182 // (no daemonization is done)
183 bb_daemonize_or_rexec(DAEMON_DEVNULL_STDIO | DAEMON_ONLY_SANITIZE, NULL); 183 bb_daemonize_or_rexec(DAEMON_DEVNULL_STDIO | DAEMON_ONLY_SANITIZE, NULL);
184 BB_EXECVP(*argv, argv); 184 BB_EXECVP(argv[0], argv);
185 exit(127); 185 bb_perror_msg_and_die("can't execute '%s'", argv[0]);
186 } 186 }
187 187
188 // validate input. 188 // 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)
383 close(STDERR_FILENO); 383 close(STDERR_FILENO);
384 384
385 BB_EXECVP(argv[0], argv); 385 BB_EXECVP(argv[0], argv);
386 bb_perror_msg_and_die("exec %s", argv[0]); 386 bb_perror_msg_and_die("can't execute '%s'", argv[0]);
387} 387}
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)
133 context_str(con)); 133 context_str(con));
134 134
135 execvp(argv[0], argv); 135 execvp(argv[0], argv);
136
137 bb_perror_msg_and_die("can't execute '%s'", argv[0]); 136 bb_perror_msg_and_die("can't execute '%s'", argv[0]);
138} 137}