aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-11-14 11:15:02 +0000
committerRon Yorston <rmy@pobox.com>2023-11-14 11:15:02 +0000
commitf444dc586b16c104a82d201d3a7caca68affe51b (patch)
tree6e39b32ab1385f6a67d5a0ddf98c4b0d33d59148 /include
parent5085fe5d56e63f23f9812bd120a8453bd6589edc (diff)
downloadbusybox-w32-f444dc586b16c104a82d201d3a7caca68affe51b.tar.gz
busybox-w32-f444dc586b16c104a82d201d3a7caca68affe51b.tar.bz2
busybox-w32-f444dc586b16c104a82d201d3a7caca68affe51b.zip
win32: only search PATH for compressor
mingw_fork_compressor() uses CreateProcess() to run the compressor program. This will often be an instance of BusyBox, but since the xv and lzma applets in BusyBox don't support compression it can be an external program. It was intended that the external program should be found using PATH. However, CreateProcess() looks in various other places before trying PATH. In particular, it first looks in the directory of the current executable, then in the current directory of the process. This can result in the wrong xz.exe or lzma.exe being found. Perform an explicit PATH search and force CreateProcess() to use the result. This change only affects the search for a compressor. The same problem also affects other uses of our popen(3) emulation. These may be addressed in future. Costs 64-80 bytes. (GitHub issue #376)
Diffstat (limited to 'include')
-rw-r--r--include/mingw.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/mingw.h b/include/mingw.h
index f6f0bf262..eab756184 100644
--- a/include/mingw.h
+++ b/include/mingw.h
@@ -136,7 +136,8 @@ int mingw_rename(const char*, const char*);
136#define rename mingw_rename 136#define rename mingw_rename
137 137
138FILE *mingw_popen(const char *cmd, const char *mode); 138FILE *mingw_popen(const char *cmd, const char *mode);
139int mingw_popen_fd(const char *cmd, const char *mode, int fd0, pid_t *pid); 139int mingw_popen_fd(const char *exe, const char *cmd, const char *mode,
140 int fd0, pid_t *pid);
140int mingw_pclose(FILE *fd); 141int mingw_pclose(FILE *fd);
141pid_t mingw_fork_compressor(int fd, const char *compressor, const char *mode); 142pid_t mingw_fork_compressor(int fd, const char *compressor, const char *mode);
142#undef popen 143#undef popen