diff options
Diffstat (limited to 'loginutils')
-rw-r--r-- | loginutils/login.c | 5 | ||||
-rw-r--r-- | loginutils/su.c | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/loginutils/login.c b/loginutils/login.c index 974125d..b5e348b 100644 --- a/loginutils/login.c +++ b/loginutils/login.c @@ -477,8 +477,9 @@ int login_main(int argc UNUSED_PARAM, char **argv) tmp = pw->pw_shell; if (!tmp || !*tmp) tmp = DEFAULT_SHELL; - /* setup_environment params: shell, clear_env, change_env, pw */ - setup_environment(tmp, !(opt & LOGIN_OPT_p), SETUP_ENV_CHANGEENV, pw); + setup_environment(tmp, + (!(opt & LOGIN_OPT_p) * SETUP_ENV_CLEARENV) + SETUP_ENV_CHANGEENV, + pw); motd(); diff --git a/loginutils/su.c b/loginutils/su.c index a3f7ed8..6356631 100644 --- a/loginutils/su.c +++ b/loginutils/su.c @@ -102,8 +102,10 @@ int su_main(int argc UNUSED_PARAM, char **argv) opt_shell = pw->pw_shell; change_identity(pw); - /* setup_environment params: shell, clear_env, change_env, pw */ - setup_environment(opt_shell, flags & SU_OPT_l, !(flags & SU_OPT_mp), pw); + setup_environment(opt_shell, + ((flags & SU_OPT_l) / SU_OPT_l * SETUP_ENV_CLEARENV) + + (!(flags & SU_OPT_mp) * SETUP_ENV_CHANGEENV), + pw); IF_SELINUX(set_current_security_context(NULL);) /* Never returns */ |