diff options
| author | NIIBE Yutaka <[email protected]> | 2026-01-08 08:33:44 +0100 |
|---|---|---|
| committer | NIIBE Yutaka <[email protected]> | 2026-01-08 08:33:44 +0100 |
| commit | dd559a6b142f672b8a633b89791349772208d9b8 (patch) | |
| tree | fa6ed815dcc340f4ba9f0673eaa34c2957313b7e | |
| parent | tests:gpg: Use GPGME_PINENTRY_MODE_LOOPBACK for tests. (diff) | |
| download | gpgme-dd559a6b142f672b8a633b89791349772208d9b8.tar.gz gpgme-dd559a6b142f672b8a633b89791349772208d9b8.zip | |
w32: Fix for process handle.
* src/assuan-support.c (my_waitpid): Call __assuan_waitpid for
libassuan 3.
* src/w32-io.c (_gpgme_io_spawn): Use process handle for libassuan 3.
--
Signed-off-by: NIIBE Yutaka <[email protected]>
| -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)) { |
