aboutsummaryrefslogtreecommitdiffstats
path: root/libarchive/filter_fork_windows.c
diff options
context:
space:
mode:
Diffstat (limited to 'libarchive/filter_fork_windows.c')
-rw-r--r--libarchive/filter_fork_windows.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/libarchive/filter_fork_windows.c b/libarchive/filter_fork_windows.c
index ad271fe68a15..8d11179f307e 100644
--- a/libarchive/filter_fork_windows.c
+++ b/libarchive/filter_fork_windows.c
@@ -31,8 +31,9 @@
#include "filter_fork.h"
-pid_t
-__archive_create_child(const char *cmd, int *child_stdin, int *child_stdout)
+int
+__archive_create_child(const char *cmd, int *child_stdin, int *child_stdout,
+ HANDLE *out_child)
{
HANDLE childStdout[2], childStdin[2],childStderr;
SECURITY_ATTRIBUTES secAtts;
@@ -44,6 +45,7 @@ __archive_create_child(const char *cmd, int *child_stdin, int *child_stdout)
char *arg0, *ext;
int i, l;
DWORD fl, fl_old;
+ HANDLE child;
childStdout[0] = childStdout[1] = INVALID_HANDLE_VALUE;
childStdin[0] = childStdin[1] = INVALID_HANDLE_VALUE;
@@ -154,13 +156,20 @@ __archive_create_child(const char *cmd, int *child_stdin, int *child_stdout)
*child_stdout = _open_osfhandle((intptr_t)childStdout[0], _O_RDONLY);
*child_stdin = _open_osfhandle((intptr_t)childStdin[1], _O_WRONLY);
+ child = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE,
+ childInfo.dwProcessId);
+ if (child == NULL) // INVALID_HANDLE_VALUE ?
+ goto fail;
+
+ *out_child = child;
+
CloseHandle(childStdout[1]);
CloseHandle(childStdin[0]);
archive_string_free(&cmdline);
archive_string_free(&fullpath);
__archive_cmdline_free(acmd);
- return (childInfo.dwProcessId);
+ return ARCHIVE_OK;
fail:
if (childStdout[0] != INVALID_HANDLE_VALUE)
@@ -176,7 +185,7 @@ fail:
archive_string_free(&cmdline);
archive_string_free(&fullpath);
__archive_cmdline_free(acmd);
- return (-1);
+ return ARCHIVE_FAILED;
}
void