From f09f4e015bffe6db5d7e63d47b23f22db4806736 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Thu, 26 Feb 2009 12:29:59 +0000 Subject: runsv: small optimization *: more paranoia around passing NULL to execl[e] function old new delta custom 240 221 -19 --- runit/runsv.c | 7 ++----- runit/runsvdir.c | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'runit') diff --git a/runit/runsv.c b/runit/runsv.c index f83d58283..4155b8f43 100644 --- a/runit/runsv.c +++ b/runit/runsv.c @@ -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; } diff --git a/runit/runsvdir.c b/runit/runsvdir.c index 7b054e410..a77bc3fd8 100644 --- a/runit/runsvdir.c +++ b/runit/runsvdir.c @@ -119,7 +119,7 @@ static NOINLINE pid_t runsv(const char *name) | (1 << SIGTERM) , SIG_DFL); #endif - execlp("runsv", "runsv", name, NULL); + execlp("runsv", "runsv", name, (char *) NULL); fatal2_cannot("start runsv ", name); } return pid; -- cgit v1.2.3