From 0dcc569a2e553bcbd008b03e6c4551fcdeed088c Mon Sep 17 00:00:00 2001 From: "Anna (navi) Figueiredo Gomes" Date: Sun, 21 Jul 2024 15:08:05 +0200 Subject: user_init.c: use a single argument for -c Signed-off-by: Anna (navi) Figueiredo Gomes --- src/user_init/user_init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/user_init/user_init.c b/src/user_init/user_init.c index ab2f1be6..8e006ea9 100644 --- a/src/user_init/user_init.c +++ b/src/user_init/user_init.c @@ -4,12 +4,14 @@ #include #include +#include "helpers.h" #include "rc.h" #define USERINIT RC_LIBEXECDIR "/sh/user-init.sh" int main(int argc, char **argv) { struct passwd *user; + char *cmd; if (argc < 3) return 1; @@ -19,5 +21,6 @@ int main(int argc, char **argv) { || setuid(user->pw_uid) == -1) return 1; - execl(user->pw_shell, user->pw_shell, "-c", USERINIT, argv[2], NULL); + xasprintf(&cmd, "%s %s", USERINIT, argv[2]); + execl(user->pw_shell, user->pw_shell, "-c", cmd, NULL); } -- cgit v1.2.3