diff options
author | NIIBE Yutaka <[email protected]> | 2022-11-09 02:33:28 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2022-11-09 02:33:28 +0000 |
commit | ba84b780df973ba7ca7f7c51fbd1b6d1a69b8c01 (patch) | |
tree | 30ad44e96e632df10d7c74c0e9426c3602c6bdb9 /src/assuan-socket-connect.c | |
parent | tests: Use common code for Windows. (diff) | |
download | libassuan-ba84b780df973ba7ca7f7c51fbd1b6d1a69b8c01.tar.gz libassuan-ba84b780df973ba7ca7f7c51fbd1b6d1a69b8c01.zip |
w32: Have PROCESS_HANDLE in struct assuan_context_s.
* src/assuan-defs.h (struct assuan_context_s): Add process_handle
field. It's "int" instead of DWORD, because of getpid function.
* src/assuan-pipe-connect.c (initial_handshake): Set ->process_handle,
not override ->pid.
* src/assuan-socket-connect.c (assuan_connect_finalize): Likewise.
* src/system-w32.c (w32_fdpass_send): Use ->process_handle.
--
In the client code, ctx->pid (by the function assuan_get_pid) may be
used to watch the finish of server process. Thus, it should not be
overridden. See: gnupg/agent/call-daemon.c.
GnuPG-bug-id: 6236
Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'src/assuan-socket-connect.c')
-rw-r--r-- | src/assuan-socket-connect.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/assuan-socket-connect.c b/src/assuan-socket-connect.c index 457edfe..629399e 100644 --- a/src/assuan-socket-connect.c +++ b/src/assuan-socket-connect.c @@ -133,8 +133,9 @@ _assuan_connect_finalize (assuan_context_t ctx, assuan_fd_t fd, "can't connect to server: %s\n", gpg_strerror (err)); else if (response == ASSUAN_RESPONSE_OK) { +#if defined(HAVE_W64_SYSTEM) || defined(HAVE_W32_SYSTEM) const char *line = ctx->inbound.line + off; - int pid = ASSUAN_INVALID_PID; + int process_handle = ASSUAN_INVALID_PID; /* Parse the message: OK ..., process %i */ line = strchr (line, ','); @@ -145,11 +146,14 @@ _assuan_connect_finalize (assuan_context_t ctx, assuan_fd_t fd, { line = strchr (line + 1, ' '); if (line) - pid = atoi (line + 1); + process_handle = atoi (line + 1); } } - if (pid != ASSUAN_INVALID_PID) - ctx->pid = pid; + if (process_handle != ASSUAN_INVALID_PID) + ctx->process_handle = process_handle; +#else + ; +#endif } else { |