aboutsummaryrefslogtreecommitdiff
path: root/toys/other/login.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-09-29 05:09:46 -0500
committerRob Landley <rob@landley.net>2015-09-29 05:09:46 -0500
commit7d6af77804adc069a83e8566250f868a6cb9786e (patch)
tree92b6b57f55c41ab13164c1d448b3cdd1129703b4 /toys/other/login.c
parent3b51a07e478d64a84e40b3a7c026b2f8566b194b (diff)
downloadtoybox-7d6af77804adc069a83e8566250f868a6cb9786e.tar.gz
Make defconfig build for nommu.
Adds XVFORK() macro, teaches xpopen_both() to call /proc/self/exe with NULL argv (and converts cpio -p to use that), adds TOYBOX_FORK guards to some unconverted commands.
Diffstat (limited to 'toys/other/login.c')
-rw-r--r--toys/other/login.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/toys/other/login.c b/toys/other/login.c
index c727bf96..7f9559aa 100644
--- a/toys/other/login.c
+++ b/toys/other/login.c
@@ -159,9 +159,7 @@ void login_main(void)
syslog(LOG_INFO, "%s logged in on %s %s %s", pwd->pw_name,
ttyname(tty), hh ? "from" : "", hh ? TT.hostname : "");
- // can't xexec here because name doesn't match argv[0]
- snprintf(toybuf, sizeof(toybuf)-1, "-%s", basename_r(pwd->pw_shell));
- toy_exec((char *[]){toybuf, 0});
- execl(pwd->pw_shell, toybuf, NULL);
- error_exit("Failed to spawn shell");
+ // not using xexec(), login calls absolute path from filesystem so must exec()
+ execl(pwd->pw_shell, xmprintf("-%s", pwd->pw_shell), (char *)0);
+ perror_exit("exec shell '%s'", pwd->pw_shell);
}