From 548ec7045bc7c80eaf03e92f390d1da2c9e9cd86 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Thu, 28 Mar 2019 12:52:44 +0000 Subject: win32: interpret absolute paths as relative to %SYSTEMDRIVE% BusyBox contains hardcoded references to absolute paths which are unique in the *nix world but on Microsoft Windows are interpreted as being on the current drive. To make these unique again consider them to be relative to %SYSTEMDRIVE%. Support this by adding functions to: - determine the system drive (not using the environment variable); - change a process's current directory to the root of the system drive; - make relative paths absolute before changing directory (if needed). The following applications have been modified: - ash references /etc/profile from the system drive; - dpkg places its data store on and installs files to the system drive; - rpm installs files to the system drive; - man looks for configuration files and man pages on the system drive. See GitHub issue #158. --- shell/ash.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index 34ddc14f1..40965bafa 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -14906,6 +14906,9 @@ int ash_main(int argc UNUSED_PARAM, char **argv) struct jmploc jmploc; struct stackmark smark; int login_sh; +#if ENABLE_PLATFORM_MINGW32 + char *sd; +#endif /* Initialize global data */ INIT_G_misc(); @@ -15014,6 +15017,16 @@ int ash_main(int argc UNUSED_PARAM, char **argv) #endif state = 1; +#if ENABLE_PLATFORM_MINGW32 + sd = get_system_drive(); + if (sd) { + char *path = xasprintf("%s/etc/profile", sd); + read_profile(path); + free(sd); + free(path); + } + else +#endif read_profile("/etc/profile"); state1: state = 2; -- cgit v1.2.3-55-g6feb