aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2018-12-14 15:12:52 +0000
committerRon Yorston <rmy@pobox.com>2018-12-14 17:41:23 +0000
commit575581082befff0e049ef67fa36bbdd2ca737e29 (patch)
tree047f75d89b1c88838bd95e1335b51a62ee5ed615 /shell
parent858091c25687727c335880dca459fe5b24259009 (diff)
downloadbusybox-w32-575581082befff0e049ef67fa36bbdd2ca737e29.tar.gz
busybox-w32-575581082befff0e049ef67fa36bbdd2ca737e29.tar.bz2
busybox-w32-575581082befff0e049ef67fa36bbdd2ca737e29.zip
ash: move code from setup_environment()
ash calls setup_environment() but only uses a small amount of its functionality. Moving the code into ash itself means we don't need to customise setup_environment() for WIN32 and can remove it from the build.
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 0b41e7931..3bbfbd694 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -14584,10 +14584,13 @@ init(void)
14584 } 14584 }
14585 } 14585 }
14586 14586
14587 /* some initialisation normally performed at login */ 14587 /* Initialise some variables normally set at login, but
14588 * only if someone hasn't already set them. */
14588 pw = xgetpwuid(getuid()); 14589 pw = xgetpwuid(getuid());
14589 setup_environment(pw->pw_shell, 14590 if (!getenv("USER")) xsetenv("USER", pw->pw_name);
14590 SETUP_ENV_CHANGEENV|SETUP_ENV_NO_CHDIR, pw); 14591 if (!getenv("LOGNAME")) xsetenv("LOGNAME", pw->pw_name);
14592 if (!getenv("HOME")) xsetenv("HOME", pw->pw_dir);
14593 if (!getenv("SHELL")) xsetenv("SHELL", DEFAULT_SHELL);
14591 } 14594 }
14592#endif 14595#endif
14593 for (envp = environ; envp && *envp; envp++) { 14596 for (envp = environ; envp && *envp; envp++) {