diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/assuan-support.c | 7 | ||||
| -rw-r--r-- | src/w32-io.c | 15 |
2 files changed, 17 insertions, 5 deletions
diff --git a/src/assuan-support.c b/src/assuan-support.c index 384b67b9..8fb45c53 100644 --- a/src/assuan-support.c +++ b/src/assuan-support.c @@ -313,13 +313,18 @@ static assuan_pid_t my_waitpid (assuan_context_t ctx, assuan_pid_t pid, int nowait, int *status, int options) { - (void)ctx; #ifdef HAVE_W32_SYSTEM +# if ASSUAN_VERSION_NUMBER < 0x030000 + (void)ctx; (void)nowait; (void)status; (void)options; (void)pid; /* Just a number without a kernel object. */ +# else + return __assuan_waitpid (ctx, pid, nowait, status, options); +# endif #else + (void)ctx; /* We can't just release the PID, a waitpid is mandatory. But NOWAIT in POSIX systems just means the caller already did the waitpid for this child. */ diff --git a/src/w32-io.c b/src/w32-io.c index b5bebd33..313803a2 100644 --- a/src/w32-io.c +++ b/src/w32-io.c @@ -1598,10 +1598,6 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, pi.hProcess, pi.hThread, (int) pi.dwProcessId, (int) pi.dwThreadId); - if (r_pid) - *r_pid = (pid_t)pi.dwProcessId; - - if (ResumeThread (pi.hThread) == (DWORD)(-1)) TRACE_LOG ("ResumeThread failed: ec=%d", (int) GetLastError ()); @@ -1609,8 +1605,19 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, TRACE_LOG ("process=%p", pi.hProcess); +#if ASSUAN_VERSION_NUMBER < 0x030000 + if (r_pid) + *r_pid = (pid_t)pi.dwProcessId; + /* We don't need to wait for the process. */ close_handle (pi.hProcess); +#else + if (r_pid) + *r_pid = (assuan_pid_t)pi.hProcess; + else + /* We don't need to wait for the process. */ + close_handle (pi.hProcess); +#endif if (! (flags & IOSPAWN_FLAG_NOCLOSE)) { |
