OSDN Git Service

login: execl() requires a path, not a file name
authorIsaac Dunham <ibid.ag@gmail.com>
Thu, 6 Aug 2015 00:48:14 +0000 (17:48 -0700)
committerRob Landley <rob@landley.net>
Sat, 8 Aug 2015 22:15:59 +0000 (17:15 -0500)
toys/other/login.c

index c44a887..c727bf9 100644 (file)
@@ -160,8 +160,8 @@ void login_main(void)
     ttyname(tty), hh ? "from" : "", hh ? TT.hostname : "");
 
   // can't xexec here because name doesn't match argv[0]
-  snprintf(toybuf, sizeof(toybuf)-1, "-%s", ss = basename_r(pwd->pw_shell));
+  snprintf(toybuf, sizeof(toybuf)-1, "-%s", basename_r(pwd->pw_shell));
   toy_exec((char *[]){toybuf, 0});
-  execl(ss, toybuf, NULL);
+  execl(pwd->pw_shell, toybuf, NULL);
   error_exit("Failed to spawn shell");
 }