add platform tweaks
[oweals/busybox.git] / runit / runsv.c
index f83d5828350b0ca7dd64c0e577264b49d662c65d..6d34dc133005de7a4b6022327d5d6deb6f6ad3fc 100644 (file)
@@ -251,7 +251,6 @@ static unsigned custom(struct svdir *s, char c)
        int w;
        char a[10];
        struct stat st;
-       char *prog[2];
 
        if (s->islog) return 0;
        strcpy(a, "control/?");
@@ -267,13 +266,11 @@ static unsigned custom(struct svdir *s, char c)
                                /* child */
                                if (haslog && dup2(logpipe.wr, 1) == -1)
                                        warn_cannot("setup stdout for control/?");
-                               prog[0] = a;
-                               prog[1] = NULL;
-                               execv(a, prog);
+                               execl(a, a, (char *) NULL);
                                fatal_cannot("run control/?");
                        }
                        /* parent */
-                       while (safe_waitpid(pid, &w, 0) == -1) {
+                       if (safe_waitpid(pid, &w, 0) == -1) {
                                warn_cannot("wait for child control/?");
                                return 0;
                        }
@@ -307,15 +304,14 @@ static void stopservice(struct svdir *s)
 static void startservice(struct svdir *s)
 {
        int p;
-       char *run[2];
+       const char *run;
 
        if (s->state == S_FINISH)
-               run[0] = (char*)"./finish";
+               run = "./finish";
        else {
-               run[0] = (char*)"./run";
+               run = "./run";
                custom(s, 'u');
        }
-       run[1] = NULL;
 
        if (s->pid != 0)
                stopservice(s); /* should never happen */
@@ -343,8 +339,8 @@ static void startservice(struct svdir *s)
                        , SIG_DFL);*/
                sig_unblock(SIGCHLD);
                sig_unblock(SIGTERM);
-               execvp(*run, run);
-               fatal2_cannot(s->islog ? "start log/" : "start ", *run);
+               execl(run, run, (char *) NULL);
+               fatal2_cannot(s->islog ? "start log/" : "start ", run);
        }
        /* parent */
        if (s->state != S_FINISH) {
@@ -398,8 +394,7 @@ static int ctrl(struct svdir *s, char c)
        case 'c': /* sig cont */
                if (s->pid && !custom(s, c))
                        kill(s->pid, SIGCONT);
-               if (s->ctrl & C_PAUSE)
-                       s->ctrl &= ~C_PAUSE;
+               s->ctrl &= ~C_PAUSE;
                update_status(s);
                break;
        case 'o': /* once */