Error out if sesh is run as a login shell but the shell it needs
to run has no slash. This shouldn't happen in practice.
This commit is contained in:
@@ -74,9 +74,10 @@ main(int argc, char *argv[], char *envp[])
|
|||||||
|
|
||||||
/* If invoked as a login shell, modify argv[0] accordingly. */
|
/* If invoked as a login shell, modify argv[0] accordingly. */
|
||||||
if (login_shell) {
|
if (login_shell) {
|
||||||
if ((cp = strrchr(argv[0], '/')) != NULL)
|
if ((cp = strrchr(argv[0], '/')) == NULL)
|
||||||
argv[0] = cp;
|
sudo_fatal(U_("unable to run %s as a login shell"), argv[0]);
|
||||||
argv[0][0] = '-';
|
*cp = '-';
|
||||||
|
argv[0] = cp;
|
||||||
}
|
}
|
||||||
sudo_execve(cmnd, argv, envp, noexec);
|
sudo_execve(cmnd, argv, envp, noexec);
|
||||||
sudo_warn(U_("unable to execute %s"), cmnd);
|
sudo_warn(U_("unable to execute %s"), cmnd);
|
||||||
|
Reference in New Issue
Block a user