summaryrefslogtreecommitdiff
path: root/loginutils
diff options
context:
space:
mode:
authorPascal Bellard2012-06-12 13:21:02 +0200
committerDenys Vlasenko2012-06-12 13:21:02 +0200
commit70fc8c17e2d032f34162f7abc3e65a67c0ff272a (patch)
treeb2a4b1b2f6d52b01056e4601aca1c676e7f0f80f /loginutils
parent588e284f53da2dc5c58f3d1b9efacd6e9061baf1 (diff)
downloadbusybox-70fc8c17e2d032f34162f7abc3e65a67c0ff272a.zip
busybox-70fc8c17e2d032f34162f7abc3e65a67c0ff272a.tar.gz
su: do not change to home dir unless -l
Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'loginutils')
-rw-r--r--loginutils/su.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/loginutils/su.c b/loginutils/su.c
index 57ea738..2ec05e1 100644
--- a/loginutils/su.c
+++ b/loginutils/su.c
@@ -131,7 +131,8 @@ int su_main(int argc UNUSED_PARAM, char **argv)
change_identity(pw);
setup_environment(opt_shell,
((flags & SU_OPT_l) / SU_OPT_l * SETUP_ENV_CLEARENV)
- + (!(flags & SU_OPT_mp) * SETUP_ENV_CHANGEENV),
+ + (!(flags & SU_OPT_mp) * SETUP_ENV_CHANGEENV)
+ + (!(flags & SU_OPT_l) * SETUP_ENV_NO_CHDIR),
pw);
IF_SELINUX(set_current_security_context(NULL);)