From 6f2592dab9edd712dde7627aa2aca98e4ae1de04 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Thu, 4 Apr 2013 13:18:01 +0100 Subject: sh: only change to user's home directory in login mode --- shell/ash.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'shell') 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) /* some initialisation normally performed at login */ pw = xgetpwuid(getuid()); - setup_environment(pw->pw_shell, SETUP_ENV_CHANGEENV, pw); + setup_environment(pw->pw_shell, + SETUP_ENV_CHANGEENV|SETUP_ENV_NO_CHDIR, pw); } #endif for (envp = environ; envp && *envp; envp++) { @@ -13823,6 +13824,11 @@ int ash_main(int argc UNUSED_PARAM, char **argv) if (isloginsh) { const char *hp; +#if ENABLE_PLATFORM_MINGW32 + chdir(xgetpwuid(getuid())->pw_dir); + setpwd(NULL, 0); +#endif + state = 1; read_profile("/etc/profile"); state1: -- cgit v1.2.3-55-g6feb