aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2022-03-22 08:12:07 +0000
committerRon Yorston <rmy@pobox.com>2022-03-22 08:12:07 +0000
commitaf41de68901d48753eb73491d54931a99d1a13b5 (patch)
treeb5c26c5d07fcc3ecca0d2cadfe964418635d67fe /shell
parentf3c5e8bc316af658260369fc2d4d1270c1f609b4 (diff)
downloadbusybox-w32-af41de68901d48753eb73491d54931a99d1a13b5.tar.gz
busybox-w32-af41de68901d48753eb73491d54931a99d1a13b5.tar.bz2
busybox-w32-af41de68901d48753eb73491d54931a99d1a13b5.zip
ash: let $HOME set home directory of login shell
In busybox-w32 the shell option '-l' sets HOME to the user's home directory, as determined by a call to GetUserProfileDirectory(). This is differs from how shells work on Unix, where HOME is usually set by login(1). Allow the user to override this behaviour by setting HOME before starting the shell. If HOME isn't set or contains an empty string the previous behaviour applies. If HOME is set to a non-empty string the user should ensure that it represents a valid absolute path. (GitHub issue #244)
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c
index d8f9dba34..e8a1e853c 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -15764,7 +15764,10 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
15764 15764
15765#if ENABLE_PLATFORM_MINGW32 15765#if ENABLE_PLATFORM_MINGW32
15766 if (!dirarg) { 15766 if (!dirarg) {
15767 chdir(xgetpwuid(getuid())->pw_dir); 15767 hp = lookupvar("HOME");
15768 if (hp == NULL || *hp == '\0')
15769 hp = xgetpwuid(getuid())->pw_dir;
15770 chdir(hp);
15768 setpwd(NULL, 0); 15771 setpwd(NULL, 0);
15769 } 15772 }
15770#endif 15773#endif