[PATCH v3 12/27] runsv: change execl calls to BB_EXECVP

Nadav Tasher tashernadav at gmail.com
Mon Jan 27 00:04:23 UTC 2025


Allows for more control over executed processes.

Signed-off-by: Nadav Tasher <tashernadav at gmail.com>
---
 runit/runsv.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/runit/runsv.c b/runit/runsv.c
index 20a445319..27676e0be 100644
--- a/runit/runsv.c
+++ b/runit/runsv.c
@@ -280,6 +280,7 @@ static unsigned custom(struct svdir *s, char c)
 	int w;
 	char a[10];
 	struct stat st;
+	char* exec_argv[2];
 
 	if (s->islog)
 		return 0;
@@ -296,7 +297,9 @@ static unsigned custom(struct svdir *s, char c)
 				/* child */
 				if (haslog && dup2(logpipe.wr, 1) == -1)
 					warn2_cannot("setup stdout for ", a);
-				execl(a, a, (char *) NULL);
+				exec_argv[0] = a;
+				exec_argv[1] = NULL;
+				BB_EXECVP(exec_argv[0], exec_argv);
 				fatal2_cannot("run ", a);
 			}
 			/* parent */
@@ -391,7 +394,7 @@ static void startservice(struct svdir *s)
 		signal(SIGTERM, SIG_DFL);
 		sig_unblock(SIGCHLD);
 		sig_unblock(SIGTERM);
-		execv(arg[0], (char**) arg);
+		BB_EXECVP(arg[0], (char**) arg);
 		fatal2_cannot(s->islog ? "start log/" : "start ", arg[0]);
 	}
 	/* parent */
-- 
2.43.0



More information about the busybox mailing list