summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2022-11-15 15:35:17 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2022-11-15 15:35:17 +0900
commit523e3cbfe29f5665ebfac205f1a6d88bf7a3df87 (patch)
treeb570a5331c70307e2cdd9965f3989aafdcaa6bde
parent05eb70c54969191c6833901d8af6a52d17d0adea (diff)
downloadlibassuan-523e3cbfe29f5665ebfac205f1a6d88bf7a3df87.tar.gz
w32: Fix confusion between process ID and process HANDLE.
* src/assuan-defs.h (struct assuan_context_s): Rename to process_id. * src/assuan-pipe-connect.c (initial_handshake): Fix variable name and access to the member field. * src/assuan-socket-connect.c (_assuan_connect_finalize): Likewise. * src/system-w32.c (get_file_handle): Likewise. (w32_fdpass_send): Likewise. -- Fixes-commit: ba84b780df973ba7ca7f7c51fbd1b6d1a69b8c01 GnuPG-bug-id: 6236 Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
-rw-r--r--src/assuan-defs.h2
-rw-r--r--src/assuan-pipe-connect.c8
-rw-r--r--src/assuan-socket-connect.c8
-rw-r--r--src/system-w32.c6
4 files changed, 12 insertions, 12 deletions
diff --git a/src/assuan-defs.h b/src/assuan-defs.h
index 0cdb08d..e92439d 100644
--- a/src/assuan-defs.h
+++ b/src/assuan-defs.h
@@ -181,7 +181,7 @@ struct assuan_context_s
set this to 1, otherwise to -1. */
pid_t pid; /* The pid of the peer. */
#if defined(HAVE_W64_SYSTEM) || defined(HAVE_W32_SYSTEM)
- int process_handle; /* process handle of the server for FD passing. */
+ int process_id; /* process ID of the server for FD passing. */
#endif
assuan_fd_t listen_fd; /* The fd we are listening on (used by
socket servers) */
diff --git a/src/assuan-pipe-connect.c b/src/assuan-pipe-connect.c
index 17d3c95..3ac18e3 100644
--- a/src/assuan-pipe-connect.c
+++ b/src/assuan-pipe-connect.c
@@ -108,7 +108,7 @@ initial_handshake (assuan_context_t ctx)
{
#if defined(HAVE_W64_SYSTEM) || defined(HAVE_W32_SYSTEM)
const char *line = ctx->inbound.line + off;
- int process_handle = ASSUAN_INVALID_PID;
+ int process_id = -1;
/* Parse the message: OK ..., process %i */
line = strchr (line, ',');
@@ -119,11 +119,11 @@ initial_handshake (assuan_context_t ctx)
{
line = strchr (line + 1, ' ');
if (line)
- process_handle = atoi (line + 1);
+ process_id = atoi (line + 1);
}
}
- if (process_handle != ASSUAN_INVALID_PID)
- ctx->process_handle = process_handle;
+ if (process_id != -1)
+ ctx->process_id = process_id;
#else
;
#endif
diff --git a/src/assuan-socket-connect.c b/src/assuan-socket-connect.c
index 629399e..2d3405f 100644
--- a/src/assuan-socket-connect.c
+++ b/src/assuan-socket-connect.c
@@ -135,7 +135,7 @@ _assuan_connect_finalize (assuan_context_t ctx, assuan_fd_t fd,
{
#if defined(HAVE_W64_SYSTEM) || defined(HAVE_W32_SYSTEM)
const char *line = ctx->inbound.line + off;
- int process_handle = ASSUAN_INVALID_PID;
+ int process_id = -1;
/* Parse the message: OK ..., process %i */
line = strchr (line, ',');
@@ -146,11 +146,11 @@ _assuan_connect_finalize (assuan_context_t ctx, assuan_fd_t fd,
{
line = strchr (line + 1, ' ');
if (line)
- process_handle = atoi (line + 1);
+ process_id = atoi (line + 1);
}
}
- if (process_handle != ASSUAN_INVALID_PID)
- ctx->process_handle = process_handle;
+ if (process_id != -1)
+ ctx->process_id = process_id;
#else
;
#endif
diff --git a/src/system-w32.c b/src/system-w32.c
index 0d6681f..b7a14c8 100644
--- a/src/system-w32.c
+++ b/src/system-w32.c
@@ -169,13 +169,13 @@ __assuan_close (assuan_context_t ctx, assuan_fd_t fd)
/* Get a file HANDLE to send, from POSIX fd. */
static gpg_error_t
-get_file_handle (int fd, int server_pid, HANDLE *r_handle)
+get_file_handle (int fd, int process_id, HANDLE *r_handle)
{
HANDLE prochandle, handle, newhandle;
handle = (void *)_get_osfhandle (fd);
- prochandle = OpenProcess (PROCESS_DUP_HANDLE, FALSE, server_pid);
+ prochandle = OpenProcess (PROCESS_DUP_HANDLE, FALSE, process_id);
if (!prochandle)
return gpg_error (GPG_ERR_ASS_PARAMETER);/*FIXME: error*/
@@ -205,7 +205,7 @@ w32_fdpass_send (assuan_context_t ctx, assuan_fd_t fd)
fd_converted_to_integer = (intptr_t)fd;
fd0 = (int)fd_converted_to_integer; /* Bit pattern is possibly truncated. */
- err = get_file_handle (fd0, ctx->process_handle, &file_handle);
+ err = get_file_handle (fd0, ctx->process_id, &file_handle);
if (err)
return err;