mirror of
https://github.com/sheumann/hush.git
synced 2024-12-25 18:33:06 +00:00
setup_environment: cd $HOME regardless of clear_env value.
This commit is contained in:
parent
91f8f82bfb
commit
f34cfff2f0
@ -32,16 +32,16 @@
|
||||
|
||||
void FAST_FUNC setup_environment(const char *shell, int clear_env, int change_env, const struct passwd *pw)
|
||||
{
|
||||
/* Change the current working directory to be the home directory
|
||||
* of the user */
|
||||
if (chdir(pw->pw_dir)) {
|
||||
xchdir("/");
|
||||
bb_error_msg("can't chdir to home directory '%s'", pw->pw_dir);
|
||||
}
|
||||
|
||||
if (clear_env) {
|
||||
const char *term;
|
||||
|
||||
/* Change the current working directory to be the home directory
|
||||
* of the user */
|
||||
if (chdir(pw->pw_dir)) {
|
||||
xchdir("/");
|
||||
bb_error_msg("can't chdir to home directory '%s'", pw->pw_dir);
|
||||
}
|
||||
|
||||
/* Leave TERM unchanged. Set HOME, SHELL, USER, LOGNAME, PATH.
|
||||
Unset all other environment variables. */
|
||||
term = getenv("TERM");
|
||||
|
Loading…
Reference in New Issue
Block a user