aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2013-04-04 13:18:01 +0100
committerRon Yorston <rmy@pobox.com>2013-04-04 13:18:01 +0100
commit6f2592dab9edd712dde7627aa2aca98e4ae1de04 (patch)
tree696c3845f132de702388907bb5c67ea4b349d0b3
parent667d5dd0a428a790df5a73d044cf9a8882ee92f8 (diff)
downloadbusybox-w32-6f2592dab9edd712dde7627aa2aca98e4ae1de04.tar.gz
busybox-w32-6f2592dab9edd712dde7627aa2aca98e4ae1de04.tar.bz2
busybox-w32-6f2592dab9edd712dde7627aa2aca98e4ae1de04.zip
sh: only change to user's home directory in login mode
-rw-r--r--shell/ash.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 369bb5bb9..e7a0e5dc5 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -13578,7 +13578,8 @@ init(void)
13578 13578
13579 /* some initialisation normally performed at login */ 13579 /* some initialisation normally performed at login */
13580 pw = xgetpwuid(getuid()); 13580 pw = xgetpwuid(getuid());
13581 setup_environment(pw->pw_shell, SETUP_ENV_CHANGEENV, pw); 13581 setup_environment(pw->pw_shell,
13582 SETUP_ENV_CHANGEENV|SETUP_ENV_NO_CHDIR, pw);
13582 } 13583 }
13583#endif 13584#endif
13584 for (envp = environ; envp && *envp; envp++) { 13585 for (envp = environ; envp && *envp; envp++) {
@@ -13823,6 +13824,11 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
13823 if (isloginsh) { 13824 if (isloginsh) {
13824 const char *hp; 13825 const char *hp;
13825 13826
13827#if ENABLE_PLATFORM_MINGW32
13828 chdir(xgetpwuid(getuid())->pw_dir);
13829 setpwd(NULL, 0);
13830#endif
13831
13826 state = 1; 13832 state = 1;
13827 read_profile("/etc/profile"); 13833 read_profile("/etc/profile");
13828 state1: 13834 state1: