aboutsummaryrefslogtreecommitdiff
path: root/shell/ash.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/ash.c')
-rw-r--r--shell/ash.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 6a4b8e273..ebed9b50e 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -15437,6 +15437,8 @@ exitshell(void)
15437} 15437}
15438 15438
15439#if ENABLE_PLATFORM_MINGW32 15439#if ENABLE_PLATFORM_MINGW32
15440/* We need to see if HOME is *really* unset */
15441# undef getenv
15440static void xsetenv_if_unset(const char *key, const char *value) 15442static void xsetenv_if_unset(const char *key, const char *value)
15441{ 15443{
15442 if (!getenv(key)) 15444 if (!getenv(key))
@@ -15531,10 +15533,12 @@ init(void)
15531 15533
15532 /* Initialise some variables normally set at login, but 15534 /* Initialise some variables normally set at login, but
15533 * only if someone hasn't already set them. */ 15535 * only if someone hasn't already set them. */
15534 pw = xgetpwuid(getuid()); 15536 pw = getpwuid(getuid());
15535 xsetenv_if_unset("USER", pw->pw_name); 15537 if (pw) {
15536 xsetenv_if_unset("LOGNAME", pw->pw_name); 15538 xsetenv_if_unset("USER", pw->pw_name);
15537 xsetenv_if_unset("HOME", pw->pw_dir); 15539 xsetenv_if_unset("LOGNAME", pw->pw_name);
15540 xsetenv_if_unset("HOME", pw->pw_dir);
15541 }
15538 xsetenv_if_unset("SHELL", DEFAULT_SHELL); 15542 xsetenv_if_unset("SHELL", DEFAULT_SHELL);
15539 } 15543 }
15540#endif 15544#endif