aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2024-07-21 15:08:05 +0200
committerAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2024-07-21 15:08:05 +0200
commit0dcc569a2e553bcbd008b03e6c4551fcdeed088c (patch)
treedd9e1c01d213f28fdac8df617abd6e4a9460bee8
parent255138dd2a69752e1f4b56a725080bbecb29a587 (diff)
user_init.c: use a single argument for -c
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
-rw-r--r--src/user_init/user_init.c5
1 files changed, 4 insertions, 1 deletions
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 <unistd.h>
#include <stdlib.h>
+#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);
}