If we are preserving the environment use SHELL instead of pw->pw_shell

This commit is contained in:
sin 2013-10-18 16:22:24 +01:00
parent acb9ae197e
commit bfb4b38cff
1 changed files with 2 additions and 1 deletions

3
su.c
View File

@ -112,7 +112,8 @@ main(int argc, char **argv)
setenv("LOGNAME", pw->pw_name, 1);
}
}
execve(pw->pw_shell, newargv, environ);
execve(pflag ? getenv("SHELL") : pw->pw_shell,
newargv, environ);
}
return (errno == ENOENT) ? 127 : 126;
}