diff options
author | NIIBE Yutaka <[email protected]> | 2023-05-25 04:49:09 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2023-05-25 05:01:09 +0000 |
commit | 3bccb33ccd9028ff505d9979fd6c8a37393b892d (patch) | |
tree | ff36c2065b3e2fe11738d9068fdcbf012b814069 /src/system-w32.c | |
parent | Allow use of global system hooks with API version 2. (diff) | |
download | libassuan-gniibe/t6487.tar.gz libassuan-gniibe/t6487.zip |
Add new pipe functions to control its server process.gniibe/t6487
* src/assuan-pipe-connect.c (assuan_pipe_wait_server_termination)
(assuan_pipe_kill_server): New.
* src/assuan.h.in: Add new functions.
* src/libassuan.def: Add symbols for those functions.
* src/libassuan.vers: Likewise.
* src/system-posix.c (__assuan_waitpid): Extend the semantics for
OPTIONS.
* src/system-w32.c (__assuan_waitpid): Likewise.
--
GnuPG-bug-id: 6487
Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to '')
-rw-r--r-- | src/system-w32.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/system-w32.c b/src/system-w32.c index 415cd63..a1ac42f 100644 --- a/src/system-w32.c +++ b/src/system-w32.c @@ -598,8 +598,30 @@ assuan_pid_t __assuan_waitpid (assuan_context_t ctx, assuan_pid_t pid, int nowait, int *status, int options) { - CloseHandle ((HANDLE) pid); - return 0; + int code; + DWORD exit_code; + + (void)ctx; + + if (nowait) + return 0; + + code = WaitForSingleObject ((HANDLE)pid, options? 0: INFINITE); + + if (code == WAIT_OBJECT_0) + { + if (status) + { + GetExitCodeProcess ((HANDLE)pid, &exit_code); + *status = (int)exit_code; + } + CloseHandle ((HANDLE)pid); + return pid; + } + else if (code == WAIT_TIMEOUT) + return 0; + else + return -1; } |