From 1c31b92725f8c121bed55d2f7446d6c7e7f7824e Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sun, 28 Apr 2019 16:42:11 +0000 Subject: Fix stage2 and stage3 invocation paths --- src/init/s6-linux-init.c | 5 ++--- src/shutdown/s6-linux-init-shutdownd.c | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/init/s6-linux-init.c b/src/init/s6-linux-init.c index 5223d54..b589ec3 100644 --- a/src/init/s6-linux-init.c +++ b/src/init/s6-linux-init.c @@ -41,12 +41,11 @@ static inline void run_stage2 (char const *basedir, char const **argv, unsigned { size_t dirlen = strlen(basedir) ; char const *childargv[argc + 3] ; - char fn[dirlen + 1 + sizeof(STAGE2)] ; + char fn[dirlen + sizeof("/scripts/" STAGE2)] ; PROG = "s6-linux-init (child)" ; argv[0] = PROG ; memcpy(fn, basedir, dirlen) ; - fn[dirlen] = '/' ; - memcpy(fn + dirlen + 1, STAGE2, sizeof(STAGE2)) ; + memcpy(fn + dirlen, "/scripts/" STAGE2, sizeof("/scripts/" STAGE2)) ; childargv[0] = fn ; childargv[1] = scan_cmdline(initdefault, argv + 1, argc - 1) ; for (unsigned int i = 0 ; i < argc ; i++) diff --git a/src/shutdown/s6-linux-init-shutdownd.c b/src/shutdown/s6-linux-init-shutdownd.c index 90d43e8..c01727d 100644 --- a/src/shutdown/s6-linux-init-shutdownd.c +++ b/src/shutdown/s6-linux-init-shutdownd.c @@ -40,10 +40,10 @@ static inline void run_stage3 (char const *basedir, char const *const *envp) { pid_t pid ; size_t basedirlen = strlen(basedir) ; - char stage3[basedirlen + sizeof("/" STAGE3)] ; + char stage3[basedirlen + sizeof("/scripts/" STAGE3)] ; char const *stage3_argv[2] = { stage3, 0 } ; memcpy(stage3, basedir, basedirlen) ; - memcpy(stage3 + basedirlen, "/" STAGE3, sizeof("/" STAGE3)) ; + memcpy(stage3 + basedirlen, "/scripts/" STAGE3, sizeof("/scripts/" STAGE3)) ; pid = child_spawn0(stage3_argv[0], stage3_argv, envp) ; if (pid) { -- cgit v1.2.3