diff options
| author | Ron Yorston <rmy@pobox.com> | 2026-07-02 13:11:37 +0100 |
|---|---|---|
| committer | Ron Yorston <rmy@pobox.com> | 2026-07-02 13:11:37 +0100 |
| commit | 882815f8740fe0c42ff53bc7df8f9bfb750d6944 (patch) | |
| tree | 10cd652d2185a95e96bfa8755f8db3fa4a643599 | |
| parent | 20495b16aaf9bc888a6fc1d10b3746c506420b04 (diff) | |
| download | busybox-w32-master.tar.gz busybox-w32-master.tar.bz2 busybox-w32-master.zip | |
Update the 'rpm' applet so it also respects the BB_SYSTEMROOT
environment variable.
Replace chdir_system_drive() with xchdir_system_drive(), which
exits on failure to change directory.
Saves 32-36 bytes.
(GitHub PR #603)
Signed-off-by: Ron Yorston <rmy@pobox.com>
| -rw-r--r-- | archival/dpkg.c | 2 | ||||
| -rw-r--r-- | archival/rpm.c | 5 | ||||
| -rw-r--r-- | include/mingw.h | 2 | ||||
| -rw-r--r-- | miscutils/man.c | 2 | ||||
| -rw-r--r-- | win32/mingw.c | 11 |
5 files changed, 10 insertions, 12 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c index e50f94ae6..dc9db92e6 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c | |||
| @@ -1864,7 +1864,7 @@ int dpkg_main(int argc UNUSED_PARAM, char **argv) | |||
| 1864 | } | 1864 | } |
| 1865 | } | 1865 | } |
| 1866 | 1866 | ||
| 1867 | chdir_system_drive(); | 1867 | xchdir_system_drive(); |
| 1868 | 1868 | ||
| 1869 | /* initialise data store */ | 1869 | /* initialise data store */ |
| 1870 | path = xstrdup(DPKG_DIR "/info"); | 1870 | path = xstrdup(DPKG_DIR "/info"); |
diff --git a/archival/rpm.c b/archival/rpm.c index c2f0550ff..81b3248d1 100644 --- a/archival/rpm.c +++ b/archival/rpm.c | |||
| @@ -308,9 +308,10 @@ static void extract_cpio(int fd, const char *source_rpm) | |||
| 308 | if (source_rpm != NULL) { | 308 | if (source_rpm != NULL) { |
| 309 | /* Binary rpm (it was built from some SRPM), install to root */ | 309 | /* Binary rpm (it was built from some SRPM), install to root */ |
| 310 | #if ENABLE_PLATFORM_MINGW32 | 310 | #if ENABLE_PLATFORM_MINGW32 |
| 311 | if (chdir_system_drive()) | 311 | xchdir_system_drive(); |
| 312 | #endif | 312 | #else |
| 313 | xchdir("/"); | 313 | xchdir("/"); |
| 314 | #endif | ||
| 314 | } /* else: SRPM, install to current dir */ | 315 | } /* else: SRPM, install to current dir */ |
| 315 | 316 | ||
| 316 | /* Initialize */ | 317 | /* Initialize */ |
diff --git a/include/mingw.h b/include/mingw.h index c2a106139..52f4605cf 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
| @@ -672,7 +672,7 @@ int enumerate_links(const char *file, char *name) FAST_FUNC; | |||
| 672 | int unc_root_len(const char *dir) FAST_FUNC; | 672 | int unc_root_len(const char *dir) FAST_FUNC; |
| 673 | int root_len(const char *path) FAST_FUNC; | 673 | int root_len(const char *path) FAST_FUNC; |
| 674 | const char *get_system_drive(void) FAST_FUNC; | 674 | const char *get_system_drive(void) FAST_FUNC; |
| 675 | int chdir_system_drive(void); | 675 | void xchdir_system_drive(void); |
| 676 | char *xabsolute_path(char *path) FAST_FUNC; | 676 | char *xabsolute_path(char *path) FAST_FUNC; |
| 677 | char *get_drive_cwd(const char *path, char *buffer, int size) FAST_FUNC; | 677 | char *get_drive_cwd(const char *path, char *buffer, int size) FAST_FUNC; |
| 678 | void fix_path_case(char *path) FAST_FUNC; | 678 | void fix_path_case(char *path) FAST_FUNC; |
diff --git a/miscutils/man.c b/miscutils/man.c index cf67f1538..e6da41624 100644 --- a/miscutils/man.c +++ b/miscutils/man.c | |||
| @@ -287,7 +287,7 @@ int man_main(int argc UNUSED_PARAM, char **argv) | |||
| 287 | if (strchr(*ptr, '/') || strchr(*ptr, '\\')) | 287 | if (strchr(*ptr, '/') || strchr(*ptr, '\\')) |
| 288 | *ptr = xabsolute_path(*ptr); | 288 | *ptr = xabsolute_path(*ptr); |
| 289 | } | 289 | } |
| 290 | chdir_system_drive(); | 290 | xchdir_system_drive(); |
| 291 | #endif | 291 | #endif |
| 292 | 292 | ||
| 293 | conf_sec_list = xstrdup("0p:1:1p:2:3:3p:4:5:6:7:8:9"); | 293 | conf_sec_list = xstrdup("0p:1:1p:2:3:3p:4:5:6:7:8:9"); |
diff --git a/win32/mingw.c b/win32/mingw.c index 28ee81e4e..6e6b20e80 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
| @@ -2461,14 +2461,11 @@ const char * FAST_FUNC get_system_drive(void) | |||
| 2461 | return getenv(BB_SYSTEMROOT) ?: drive; | 2461 | return getenv(BB_SYSTEMROOT) ?: drive; |
| 2462 | } | 2462 | } |
| 2463 | 2463 | ||
| 2464 | int chdir_system_drive(void) | 2464 | void xchdir_system_drive(void) |
| 2465 | { | 2465 | { |
| 2466 | const char *sd = get_system_drive(); | 2466 | char *path = concat_path_file(get_system_drive(), ""); |
| 2467 | int ret = -1; | 2467 | xchdir(path); |
| 2468 | 2468 | free(path); | |
| 2469 | if (*sd) | ||
| 2470 | ret = chdir(auto_string(concat_path_file(sd, ""))); | ||
| 2471 | return ret; | ||
| 2472 | } | 2469 | } |
| 2473 | 2470 | ||
| 2474 | /* | 2471 | /* |
