blob: d8a0d7d46adb697aafad746fd97ae07469c16e31 [file] [log] [blame]
Eric Andersenc2af1ee2001-10-18 19:33:06 +00001/* vi: set sw=4 ts=4: */
2/*
3 * Mini start-stop-daemon implementation(s) for busybox
4 *
5 * Written by Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>,
Eric Andersenc2af1ee2001-10-18 19:33:06 +00006 * Adapted for busybox David Kimdon <dwhedon@gordian.com>
Rob Landleyd921b2e2006-08-03 15:41:12 +00007 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
Eric Andersenc2af1ee2001-10-18 19:33:06 +00009 */
10
Denis Vlasenkoa1b16f42007-07-31 17:09:44 +000011/* NB: we have a problem here with /proc/NN/exe usage, similar to
12 * one fixed in killall/pidof */
13
Rob Landleyd921b2e2006-08-03 15:41:12 +000014#include <getopt.h>
Denis Vlasenkoca3c9812006-10-08 23:36:17 +000015#include <sys/resource.h>
Eric Andersenc2af1ee2001-10-18 19:33:06 +000016
Denis Vlasenkob6adbf12007-05-26 19:00:18 +000017#include "libbb.h"
18
Eric Andersenc2af1ee2001-10-18 19:33:06 +000019static int signal_nr = 15;
20static int user_id = -1;
Rob Landleyd921b2e2006-08-03 15:41:12 +000021static char *userspec;
Rob Landleyd921b2e2006-08-03 15:41:12 +000022static char *cmdname;
23static char *execname;
24static char *pidfile;
Denis Vlasenkocce38582007-02-26 22:47:42 +000025static smallint quiet;
Eric Andersenc2af1ee2001-10-18 19:33:06 +000026
Eric Andersen63a1a7a2004-03-13 08:33:10 +000027struct pid_list {
Eric Andersenc2af1ee2001-10-18 19:33:06 +000028 struct pid_list *next;
Eric Andersen63a1a7a2004-03-13 08:33:10 +000029 pid_t pid;
30};
Eric Andersenc2af1ee2001-10-18 19:33:06 +000031
Denis Vlasenkob131b272006-12-17 17:30:01 +000032static struct pid_list *found;
Eric Andersenc2af1ee2001-10-18 19:33:06 +000033
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +000034static int pid_is_exec(pid_t pid, const char *name)
Eric Andersenc2af1ee2001-10-18 19:33:06 +000035{
Denis Vlasenko61126ab2006-11-18 22:03:26 +000036 char buf[sizeof("/proc//exe") + sizeof(int)*3];
37 char *execbuf;
Denis Vlasenkoa1b16f42007-07-31 17:09:44 +000038 int n;
Eric Andersen63a1a7a2004-03-13 08:33:10 +000039
Denis Vlasenkoa1b16f42007-07-31 17:09:44 +000040 sprintf(buf, "/proc/%u/exe", pid);
41 n = strlen(name) + 1;
42 execbuf = xzalloc(n + 1);
43 readlink(buf, execbuf, n);
Denis Vlasenko9213a9e2006-09-17 16:28:10 +000044
Denis Vlasenkob131b272006-12-17 17:30:01 +000045 /* if readlink fails, execbuf still contains "" */
Denis Vlasenkoa1b16f42007-07-31 17:09:44 +000046 n = strcmp(execbuf, name);
Rob Landley8cedaba2006-09-04 18:59:39 +000047 if (ENABLE_FEATURE_CLEAN_UP)
48 free(execbuf);
Denis Vlasenkoa1b16f42007-07-31 17:09:44 +000049 return ~n; /* nonzero (true) if execbuf == name */
Eric Andersenc2af1ee2001-10-18 19:33:06 +000050}
51
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +000052static int pid_is_user(int pid, int uid)
Eric Andersenc2af1ee2001-10-18 19:33:06 +000053{
54 struct stat sb;
Denis Vlasenko61126ab2006-11-18 22:03:26 +000055 char buf[sizeof("/proc/") + sizeof(int)*3];
Eric Andersenc2af1ee2001-10-18 19:33:06 +000056
Denis Vlasenkob131b272006-12-17 17:30:01 +000057 sprintf(buf, "/proc/%u", pid);
Eric Andersenc2af1ee2001-10-18 19:33:06 +000058 if (stat(buf, &sb) != 0)
59 return 0;
60 return (sb.st_uid == uid);
61}
62
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +000063static int pid_is_cmd(pid_t pid, const char *name)
Eric Andersenc2af1ee2001-10-18 19:33:06 +000064{
Denis Vlasenkob131b272006-12-17 17:30:01 +000065 char fname[sizeof("/proc//stat") + sizeof(int)*3];
66 char *buf;
67 int r = 0;
Eric Andersenc2af1ee2001-10-18 19:33:06 +000068
Denis Vlasenkob131b272006-12-17 17:30:01 +000069 sprintf(fname, "/proc/%u/stat", pid);
70 buf = xmalloc_open_read_close(fname, NULL);
71 if (buf) {
72 char *p = strchr(buf, '(');
73 if (p) {
74 char *pe = strrchr(++p, ')');
75 if (pe) {
76 *pe = '\0';
77 r = !strcmp(p, name);
78 }
79 }
80 free(buf);
Eric Andersenc2af1ee2001-10-18 19:33:06 +000081 }
Denis Vlasenkob131b272006-12-17 17:30:01 +000082 return r;
Eric Andersenc2af1ee2001-10-18 19:33:06 +000083}
84
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +000085static void check(int pid)
Eric Andersenc2af1ee2001-10-18 19:33:06 +000086{
Denis Vlasenkoa1b16f42007-07-31 17:09:44 +000087 struct pid_list *p;
88
Eric Andersenc2af1ee2001-10-18 19:33:06 +000089 if (execname && !pid_is_exec(pid, execname)) {
90 return;
91 }
92 if (userspec && !pid_is_user(pid, user_id)) {
93 return;
94 }
95 if (cmdname && !pid_is_cmd(pid, cmdname)) {
96 return;
97 }
Denis Vlasenkoa1b16f42007-07-31 17:09:44 +000098 p = xmalloc(sizeof(*p));
99 p->next = found;
100 p->pid = pid;
101 found = p;
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000102}
103
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +0000104static void do_pidfile(void)
Eric Andersen63a1a7a2004-03-13 08:33:10 +0000105{
106 FILE *f;
Denis Vlasenkoa1b16f42007-07-31 17:09:44 +0000107 unsigned pid;
Eric Andersen63a1a7a2004-03-13 08:33:10 +0000108
Eric Andersen625da9d2004-04-13 18:28:46 +0000109 f = fopen(pidfile, "r");
Eric Andersen63a1a7a2004-03-13 08:33:10 +0000110 if (f) {
Denis Vlasenkob131b272006-12-17 17:30:01 +0000111 if (fscanf(f, "%u", &pid) == 1)
Eric Andersen63a1a7a2004-03-13 08:33:10 +0000112 check(pid);
113 fclose(f);
114 } else if (errno != ENOENT)
Eric Andersen625da9d2004-04-13 18:28:46 +0000115 bb_perror_msg_and_die("open pidfile %s", pidfile);
Eric Andersen63a1a7a2004-03-13 08:33:10 +0000116}
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000117
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +0000118static void do_procinit(void)
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000119{
120 DIR *procdir;
121 struct dirent *entry;
122 int foundany, pid;
123
Eric Andersen625da9d2004-04-13 18:28:46 +0000124 if (pidfile) {
125 do_pidfile();
126 return;
127 }
128
Rob Landleyd921b2e2006-08-03 15:41:12 +0000129 procdir = xopendir("/proc");
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000130
131 foundany = 0;
132 while ((entry = readdir(procdir)) != NULL) {
Denis Vlasenkob131b272006-12-17 17:30:01 +0000133 pid = bb_strtou(entry->d_name, NULL, 10);
134 if (errno)
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000135 continue;
136 foundany++;
137 check(pid);
138 }
139 closedir(procdir);
140 if (!foundany)
Denis Vlasenkoa1b16f42007-07-31 17:09:44 +0000141 bb_error_msg_and_die("nothing in /proc - not mounted?");
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000142}
143
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +0000144static int do_stop(void)
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000145{
Denis Vlasenko61126ab2006-11-18 22:03:26 +0000146 char *what;
Eric Andersen63a1a7a2004-03-13 08:33:10 +0000147 struct pid_list *p;
Eric Andersen950d8b42001-10-31 09:55:39 +0000148 int killed = 0;
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000149
Eric Andersen625da9d2004-04-13 18:28:46 +0000150 do_procinit();
Eric Andersen63a1a7a2004-03-13 08:33:10 +0000151
Denis Vlasenkoa1b16f42007-07-31 17:09:44 +0000152 if (cmdname) {
153 if (ENABLE_FEATURE_CLEAN_UP) what = xstrdup(cmdname);
154 if (!ENABLE_FEATURE_CLEAN_UP) what = cmdname;
155 } else if (execname) {
156 if (ENABLE_FEATURE_CLEAN_UP) what = xstrdup(execname);
157 if (!ENABLE_FEATURE_CLEAN_UP) what = execname;
158 } else if (pidfile)
Denis Vlasenko61126ab2006-11-18 22:03:26 +0000159 what = xasprintf("process in pidfile '%s'", pidfile);
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000160 else if (userspec)
Denis Vlasenko61126ab2006-11-18 22:03:26 +0000161 what = xasprintf("process(es) owned by '%s'", userspec);
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000162 else
Denis Vlasenko61126ab2006-11-18 22:03:26 +0000163 bb_error_msg_and_die("internal error, please report");
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000164
165 if (!found) {
Eric Andersen63a1a7a2004-03-13 08:33:10 +0000166 if (!quiet)
Denis Vlasenko61126ab2006-11-18 22:03:26 +0000167 printf("no %s found; none killed\n", what);
Denis Vlasenkoa1b16f42007-07-31 17:09:44 +0000168 killed = -1;
169 goto ret;
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000170 }
171 for (p = found; p; p = p->next) {
Eric Andersen950d8b42001-10-31 09:55:39 +0000172 if (kill(p->pid, signal_nr) == 0) {
Denis Vlasenkoa1b16f42007-07-31 17:09:44 +0000173 p->pid = - p->pid;
Eric Andersen950d8b42001-10-31 09:55:39 +0000174 killed++;
175 } else {
Denis Vlasenkoa1b16f42007-07-31 17:09:44 +0000176 bb_perror_msg("warning: killing process %u", p->pid);
Eric Andersen950d8b42001-10-31 09:55:39 +0000177 }
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000178 }
Eric Andersen63a1a7a2004-03-13 08:33:10 +0000179 if (!quiet && killed) {
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000180 printf("stopped %s (pid", what);
Eric Andersen950d8b42001-10-31 09:55:39 +0000181 for (p = found; p; p = p->next)
Denis Vlasenko51742f42007-04-12 00:32:05 +0000182 if (p->pid < 0)
Denis Vlasenkoa1b16f42007-07-31 17:09:44 +0000183 printf(" %u", - p->pid);
Denis Vlasenko61126ab2006-11-18 22:03:26 +0000184 puts(")");
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000185 }
Denis Vlasenkoa1b16f42007-07-31 17:09:44 +0000186 ret:
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +0000187 if (ENABLE_FEATURE_CLEAN_UP)
Denis Vlasenko61126ab2006-11-18 22:03:26 +0000188 free(what);
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +0000189 return killed;
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000190}
191
Bernhard Reutner-Fischer01d23ad2006-05-26 20:19:22 +0000192#if ENABLE_FEATURE_START_STOP_DAEMON_LONG_OPTIONS
Denis Vlasenkobdc88fd2007-07-23 17:14:14 +0000193static const char start_stop_daemon_longopts[] =
194 "stop\0" No_argument "K"
195 "start\0" No_argument "S"
196 "background\0" No_argument "b"
197 "quiet\0" No_argument "q"
198 "make-pidfile\0" No_argument "m"
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +0000199#if ENABLE_FEATURE_START_STOP_DAEMON_FANCY
Denis Vlasenkobdc88fd2007-07-23 17:14:14 +0000200 "oknodo\0" No_argument "o"
201 "verbose\0" No_argument "v"
202 "nicelevel\0" Required_argument "N"
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +0000203#endif
Denis Vlasenkobdc88fd2007-07-23 17:14:14 +0000204 "startas\0" Required_argument "a"
205 "name\0" Required_argument "n"
206 "signal\0" Required_argument "s"
207 "user\0" Required_argument "u"
208 "chuid\0" Required_argument "c"
209 "exec\0" Required_argument "x"
210 "pidfile\0" Required_argument "p"
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +0000211#if ENABLE_FEATURE_START_STOP_DAEMON_FANCY
Denis Vlasenkobdc88fd2007-07-23 17:14:14 +0000212 "retry\0" Required_argument "R"
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +0000213#endif
Denis Vlasenko990d0f62007-07-24 15:54:42 +0000214 ;
Bernhard Reutner-Fischer01d23ad2006-05-26 20:19:22 +0000215#endif
Eric Andersenaa820db2003-07-26 09:10:35 +0000216
Denis Vlasenkob8c77b52006-12-17 19:43:10 +0000217enum {
218 CTX_STOP = 0x1,
219 CTX_START = 0x2,
Denis Vlasenkocce38582007-02-26 22:47:42 +0000220 OPT_BACKGROUND = 0x4, // -b
221 OPT_QUIET = 0x8, // -q
222 OPT_MAKEPID = 0x10, // -m
223 OPT_a = 0x20, // -a
224 OPT_n = 0x40, // -n
225 OPT_s = 0x80, // -s
226 OPT_u = 0x100, // -u
227 OPT_c = 0x200, // -c
228 OPT_x = 0x400, // -x
229 OPT_p = 0x800, // -p
230 OPT_OKNODO = 0x1000 * ENABLE_FEATURE_START_STOP_DAEMON_FANCY, // -o
231 OPT_VERBOSE = 0x2000 * ENABLE_FEATURE_START_STOP_DAEMON_FANCY, // -v
232 OPT_NICELEVEL = 0x4000 * ENABLE_FEATURE_START_STOP_DAEMON_FANCY, // -N
Denis Vlasenkob8c77b52006-12-17 19:43:10 +0000233};
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +0000234
Denis Vlasenko06af2162007-02-03 17:28:39 +0000235int start_stop_daemon_main(int argc, char **argv);
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +0000236int start_stop_daemon_main(int argc, char **argv)
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000237{
Denis Vlasenko67b23e62006-10-03 21:00:06 +0000238 unsigned opt;
Denis Vlasenkocce38582007-02-26 22:47:42 +0000239 char *signame;
240 char *startas;
241 char *chuid;
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +0000242#if ENABLE_FEATURE_START_STOP_DAEMON_FANCY
243// char *retry_arg = NULL;
244// int retries = -1;
Denis Vlasenkoca3c9812006-10-08 23:36:17 +0000245 char *opt_N;
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +0000246#endif
Bernhard Reutner-Fischer01d23ad2006-05-26 20:19:22 +0000247#if ENABLE_FEATURE_START_STOP_DAEMON_LONG_OPTIONS
Denis Vlasenkobdc88fd2007-07-23 17:14:14 +0000248 applet_long_options = start_stop_daemon_longopts;
Bernhard Reutner-Fischer01d23ad2006-05-26 20:19:22 +0000249#endif
Eric Andersenaa820db2003-07-26 09:10:35 +0000250
"Vladimir N. Oleynik"064f04e2005-10-11 14:38:01 +0000251 /* Check required one context option was given */
Denis Vlasenko09196572007-07-21 13:27:44 +0000252 opt_complementary = "K:S:K--S:S--K:m?p:K?xpun:S?xa";
Denis Vlasenkocce38582007-02-26 22:47:42 +0000253 opt = getopt32(argc, argv, "KSbqma:n:s:u:c:x:p:"
254 USE_FEATURE_START_STOP_DAEMON_FANCY("ovN:"),
255// USE_FEATURE_START_STOP_DAEMON_FANCY("ovN:R:"),
256 &startas, &cmdname, &signame, &userspec, &chuid, &execname, &pidfile
Denis Vlasenkoca3c9812006-10-08 23:36:17 +0000257 USE_FEATURE_START_STOP_DAEMON_FANCY(,&opt_N)
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +0000258// USE_FEATURE_START_STOP_DAEMON_FANCY(,&retry_arg)
Denis Vlasenkocce38582007-02-26 22:47:42 +0000259 );
Eric Andersenaa820db2003-07-26 09:10:35 +0000260
Denis Vlasenkob8c77b52006-12-17 19:43:10 +0000261 quiet = (opt & OPT_QUIET) && !(opt & OPT_VERBOSE);
Paul Foxbb9a0ad2005-07-29 14:58:09 +0000262
Denis Vlasenkocce38582007-02-26 22:47:42 +0000263 if (opt & OPT_s) {
Rob Landley84790632006-08-28 20:30:27 +0000264 signal_nr = get_signum(signame);
265 if (signal_nr < 0) bb_show_usage();
Eric Andersen08804ce2003-07-30 08:29:56 +0000266 }
Eric Andersenaa820db2003-07-26 09:10:35 +0000267
Denis Vlasenkocce38582007-02-26 22:47:42 +0000268 if (!(opt & OPT_a))
Eric Andersenaa820db2003-07-26 09:10:35 +0000269 startas = execname;
270
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +0000271// USE_FEATURE_START_STOP_DAEMON_FANCY(
272// if (retry_arg)
Denis Vlasenko13858992006-10-08 12:49:22 +0000273// retries = xatoi_u(retry_arg);
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +0000274// )
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000275 argc -= optind;
276 argv += optind;
277
Denis Vlasenkob131b272006-12-17 17:30:01 +0000278 if (userspec) {
279 user_id = bb_strtou(userspec, NULL, 10);
280 if (errno)
Denis Vlasenko9a44c4f2006-12-28 05:44:47 +0000281 user_id = xuname2uid(userspec);
Denis Vlasenkob131b272006-12-17 17:30:01 +0000282 }
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000283
Denis Vlasenkob8c77b52006-12-17 19:43:10 +0000284 if (opt & CTX_STOP) {
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +0000285 int i = do_stop();
Denis Vlasenkoa1b16f42007-07-31 17:09:44 +0000286 return (opt & OPT_OKNODO) ? 0 : (i <= 0);
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000287 }
288
Eric Andersen625da9d2004-04-13 18:28:46 +0000289 do_procinit();
290
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000291 if (found) {
Eric Andersen63a1a7a2004-03-13 08:33:10 +0000292 if (!quiet)
Denis Vlasenkoca3c9812006-10-08 23:36:17 +0000293 printf("%s already running\n%d\n", execname, found->pid);
Denis Vlasenkob8c77b52006-12-17 19:43:10 +0000294 return !(opt & OPT_OKNODO);
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000295 }
296 *--argv = startas;
Denis Vlasenkob8c77b52006-12-17 19:43:10 +0000297 if (opt & OPT_BACKGROUND) {
Denis Vlasenkoa1b16f42007-07-31 17:09:44 +0000298#if BB_MMU
Denis Vlasenko5a142022007-03-26 13:20:54 +0000299 bb_daemonize(0);
Denis Vlasenkoa1b16f42007-07-31 17:09:44 +0000300#else
301 pid_t pid = vfork();
302 if (pid < 0) /* error */
303 bb_perror_msg_and_die("vfork");
304 if (pid == 0) /* parent */
305 return 0;
306 }
307 /* child */
308 /* Redirect stdio to /dev/null, close extra FDs.
309 * We do not actually daemonize because of DAEMON_ONLY_SANITIZE */
310 bb_daemonize_or_rexec(
311 DAEMON_DEVNULL_STDIO
312 + DAEMON_CLOSE_EXTRA_FDS
313 + DAEMON_ONLY_SANITIZE,
314 NULL /* argv, unused */ );
315#endif
Eric Andersen53a22992002-01-26 09:04:45 +0000316 }
Denis Vlasenkob8c77b52006-12-17 19:43:10 +0000317 if (opt & OPT_MAKEPID) {
Eric Andersen625da9d2004-04-13 18:28:46 +0000318 /* user wants _us_ to make the pidfile */
Rob Landleyd921b2e2006-08-03 15:41:12 +0000319 FILE *pidf = xfopen(pidfile, "w");
Bernhard Reutner-Fischera926f8e2006-06-11 17:24:01 +0000320
Eric Andersen625da9d2004-04-13 18:28:46 +0000321 pid_t pidt = getpid();
Eric Andersen625da9d2004-04-13 18:28:46 +0000322 fprintf(pidf, "%d\n", pidt);
323 fclose(pidf);
324 }
Denis Vlasenkocce38582007-02-26 22:47:42 +0000325 if (opt & OPT_c) {
326 struct bb_uidgid_t ugid;
327 parse_chown_usergroup_or_die(&ugid, chuid);
328 if (ugid.gid != (gid_t) -1) xsetgid(ugid.gid);
329 if (ugid.uid != (uid_t) -1) xsetuid(ugid.uid);
Rob Landleyf0623a22006-07-17 00:35:07 +0000330 }
Denis Vlasenkoca3c9812006-10-08 23:36:17 +0000331#if ENABLE_FEATURE_START_STOP_DAEMON_FANCY
Denis Vlasenkob8c77b52006-12-17 19:43:10 +0000332 if (opt & OPT_NICELEVEL) {
Denis Vlasenkoca3c9812006-10-08 23:36:17 +0000333 /* Set process priority */
334 int prio = getpriority(PRIO_PROCESS, 0) + xatoi_range(opt_N, INT_MIN/2, INT_MAX/2);
335 if (setpriority(PRIO_PROCESS, 0, prio) < 0) {
336 bb_perror_msg_and_die("setpriority(%d)", prio);
337 }
338 }
339#endif
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000340 execv(startas, argv);
Denis Vlasenko89f0b342006-11-18 22:04:09 +0000341 bb_perror_msg_and_die("cannot start %s", startas);
Eric Andersenc2af1ee2001-10-18 19:33:06 +0000342}