aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-07-22 10:49:27 +0100
committerRon Yorston <rmy@pobox.com>2021-07-22 10:49:27 +0100
commit45863925a722c75b6ca4ba055c4a7d54f53d3f95 (patch)
tree7d2872b24e6af2b256e3760ab8e851e61cc7ec01
parent09fac3deea3d74ca283f0a7109e4b190cdf97d95 (diff)
downloadbusybox-w32-45863925a722c75b6ca4ba055c4a7d54f53d3f95.tar.gz
busybox-w32-45863925a722c75b6ca4ba055c4a7d54f53d3f95.tar.bz2
busybox-w32-45863925a722c75b6ca4ba055c4a7d54f53d3f95.zip
tar: use external program for lzma/xz compression
The lzma and xz applets don't support compression. Any attempt to generate a tar file using these compressors should try to use an external program. (Which probably won't work on a typical Windows system, but hey, at least we made the effort.) See GitHub issue #222.
-rw-r--r--win32/popen.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/win32/popen.c b/win32/popen.c
index 8810b8de0..c9ea00ffd 100644
--- a/win32/popen.c
+++ b/win32/popen.c
@@ -315,11 +315,17 @@ pid_t mingw_fork_compressor(int fd, const char *compressor, const char *mode)
315 int fd1; 315 int fd1;
316 pid_t pid; 316 pid_t pid;
317 317
318 if (find_applet_by_name(compressor) >= 0) 318 if (find_applet_by_name(compressor) < 0
319#if ENABLE_XZ || ENABLE_LZMA
320 /* xz and lzma applets don't support compression, try using
321 * an external program */
322 || (mode[0] == 'w' && index_in_strings("lzma\0xz\0", compressor) >= 0)
323#endif
324 )
325 cmd = xasprintf("%s -cf -", compressor);
326 else
319 cmd = xasprintf("%s --busybox %s -cf -", bb_busybox_exec_path, 327 cmd = xasprintf("%s --busybox %s -cf -", bb_busybox_exec_path,
320 compressor); 328 compressor);
321 else
322 cmd = xasprintf("%s -cf -", compressor);
323 329
324 if ((fd1 = mingw_popen_fd(cmd, mode, fd, &pid)) == -1) 330 if ((fd1 = mingw_popen_fd(cmd, mode, fd, &pid)) == -1)
325 bb_perror_msg_and_die("can't execute '%s'", compressor); 331 bb_perror_msg_and_die("can't execute '%s'", compressor);