diff options
| author | Ron Yorston <rmy@pobox.com> | 2019-03-28 12:52:44 +0000 |
|---|---|---|
| committer | Ron Yorston <rmy@pobox.com> | 2019-03-28 13:09:50 +0000 |
| commit | 548ec7045bc7c80eaf03e92f390d1da2c9e9cd86 (patch) | |
| tree | b4c0102539c8889eeeec9eef8afa863510c7592b /shell | |
| parent | 215e01e70f13f28d1a4dbe297f095b25de04ee21 (diff) | |
| download | busybox-w32-548ec7045bc7c80eaf03e92f390d1da2c9e9cd86.tar.gz busybox-w32-548ec7045bc7c80eaf03e92f390d1da2c9e9cd86.tar.bz2 busybox-w32-548ec7045bc7c80eaf03e92f390d1da2c9e9cd86.zip | |
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.
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/ash.c | 13 |
1 files changed, 13 insertions, 0 deletions
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) | |||
| 14906 | struct jmploc jmploc; | 14906 | struct jmploc jmploc; |
| 14907 | struct stackmark smark; | 14907 | struct stackmark smark; |
| 14908 | int login_sh; | 14908 | int login_sh; |
| 14909 | #if ENABLE_PLATFORM_MINGW32 | ||
| 14910 | char *sd; | ||
| 14911 | #endif | ||
| 14909 | 14912 | ||
| 14910 | /* Initialize global data */ | 14913 | /* Initialize global data */ |
| 14911 | INIT_G_misc(); | 14914 | INIT_G_misc(); |
| @@ -15014,6 +15017,16 @@ int ash_main(int argc UNUSED_PARAM, char **argv) | |||
| 15014 | #endif | 15017 | #endif |
| 15015 | 15018 | ||
| 15016 | state = 1; | 15019 | state = 1; |
| 15020 | #if ENABLE_PLATFORM_MINGW32 | ||
| 15021 | sd = get_system_drive(); | ||
| 15022 | if (sd) { | ||
| 15023 | char *path = xasprintf("%s/etc/profile", sd); | ||
| 15024 | read_profile(path); | ||
| 15025 | free(sd); | ||
| 15026 | free(path); | ||
| 15027 | } | ||
| 15028 | else | ||
| 15029 | #endif | ||
| 15017 | read_profile("/etc/profile"); | 15030 | read_profile("/etc/profile"); |
| 15018 | state1: | 15031 | state1: |
| 15019 | state = 2; | 15032 | state = 2; |
