diff options
Diffstat (limited to 'libbb/setup_environment.c')
-rw-r--r-- | libbb/setup_environment.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libbb/setup_environment.c b/libbb/setup_environment.c index df2983958..37777204e 100644 --- a/libbb/setup_environment.c +++ b/libbb/setup_environment.c | |||
@@ -36,7 +36,7 @@ void FAST_FUNC setup_environment(const char *shell, int flags, const struct pass | |||
36 | 36 | ||
37 | /* Change the current working directory to be the home directory | 37 | /* Change the current working directory to be the home directory |
38 | * of the user */ | 38 | * of the user */ |
39 | if (!(flags & SETUP_ENV_NO_CHDIR)) { | 39 | if (flags & SETUP_ENV_CHDIR) { |
40 | if (chdir(pw->pw_dir) != 0) { | 40 | if (chdir(pw->pw_dir) != 0) { |
41 | bb_error_msg("can't change directory to '%s'", pw->pw_dir); | 41 | bb_error_msg("can't change directory to '%s'", pw->pw_dir); |
42 | xchdir((flags & SETUP_ENV_TO_TMP) ? "/tmp" : "/"); | 42 | xchdir((flags & SETUP_ENV_TO_TMP) ? "/tmp" : "/"); |
@@ -59,7 +59,8 @@ void FAST_FUNC setup_environment(const char *shell, int flags, const struct pass | |||
59 | //xsetenv("LOGNAME", pw->pw_name); | 59 | //xsetenv("LOGNAME", pw->pw_name); |
60 | //xsetenv("HOME", pw->pw_dir); | 60 | //xsetenv("HOME", pw->pw_dir); |
61 | //xsetenv("SHELL", shell); | 61 | //xsetenv("SHELL", shell); |
62 | } else if (flags & SETUP_ENV_CHANGEENV) { | 62 | } else |
63 | if (flags & (SETUP_ENV_CHANGEENV|SETUP_ENV_CHANGEENV_LOGNAME)) { | ||
63 | /* Set HOME, SHELL, and if not becoming a super-user | 64 | /* Set HOME, SHELL, and if not becoming a super-user |
64 | * or if SETUP_ENV_CHANGEENV_LOGNAME, USER and LOGNAME. */ | 65 | * or if SETUP_ENV_CHANGEENV_LOGNAME, USER and LOGNAME. */ |
65 | if ((flags & SETUP_ENV_CHANGEENV_LOGNAME) || pw->pw_uid != 0) { | 66 | if ((flags & SETUP_ENV_CHANGEENV_LOGNAME) || pw->pw_uid != 0) { |