summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_write_set_compression_program.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libarchive/archive_write_set_compression_program.c')
-rw-r--r--lib/libarchive/archive_write_set_compression_program.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/libarchive/archive_write_set_compression_program.c b/lib/libarchive/archive_write_set_compression_program.c
index b910ef6..3cd5c93 100644
--- a/lib/libarchive/archive_write_set_compression_program.c
+++ b/lib/libarchive/archive_write_set_compression_program.c
@@ -28,7 +28,9 @@
__FBSDID("$FreeBSD$");
/* This capability is only available on POSIX systems. */
-#if !defined(HAVE_PIPE) || !defined(HAVE_VFORK) || !defined(HAVE_FCNTL)
+#if !defined(HAVE_PIPE) || !defined(HAVE_FCNTL) || \
+ !(defined(HAVE_FORK) || defined(HAVE_VFORK))
+#include "archive.h"
/*
* On non-Posix systems, allow the program to build, but choke if
@@ -180,6 +182,12 @@ restart_write:
if (ret == -1 && errno != EAGAIN)
return (-1);
+ if (state->child_stdout == -1) {
+ fcntl(state->child_stdin, F_SETFL, 0);
+ __archive_check_child(state->child_stdin, state->child_stdout);
+ goto restart_write;
+ }
+
do {
ret = read(state->child_stdout,
state->child_buf + state->child_buf_avail,
OpenPOWER on IntegriCloud