diff options
author | NIIBE Yutaka <[email protected]> | 2023-05-30 04:25:00 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2023-08-03 07:34:08 +0000 |
commit | ed4050e01172479fb5dda968c1ee8fec59b778d9 (patch) | |
tree | 10363d3e571a81aab530fc5ef9a08a8de5764940 /agent/call-pinentry.c | |
parent | agent,dirmgr,gpg,g13,kbx,scd,sm,tmp2d: Remove ASSUAN_SYSTEM_NPTH. (diff) | |
download | gnupg-ed4050e01172479fb5dda968c1ee8fec59b778d9.tar.gz gnupg-ed4050e01172479fb5dda968c1ee8fec59b778d9.zip |
agent: Use new libassuan API for pipe server process.
* agent/call-daemon.c (struct wait_child_thread_parm_s): Remove PID
field.
(wait_child_thread): Don't touch the internals but call
assuan_pipe_wait_server_termination.
(daemon_start): Don't use PID.
(agent_daemon_dump_state): Don't use PID.
* agent/call-pinentry.c (watch_sock): Call assuan_pipe_kill_server.
(agent_popup_message_stop): Likewise.
--
GnuPG-bug-id: 6487
Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'agent/call-pinentry.c')
-rw-r--r-- | agent/call-pinentry.c | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c index 9d8d93aec..ba0e41c82 100644 --- a/agent/call-pinentry.c +++ b/agent/call-pinentry.c @@ -1288,8 +1288,6 @@ build_cmd_setdesc (char *line, size_t linelen, const char *desc) static void * watch_sock (void *arg) { - pid_t pid = assuan_get_pid (entry_ctx); - while (1) { int err; @@ -1317,17 +1315,7 @@ watch_sock (void *arg) break; } - if (pid == (pid_t)(-1)) - ; /* No pid available can't send a kill. */ -#ifdef HAVE_W32_SYSTEM - /* Older versions of assuan set PID to 0 on Windows to indicate an - invalid value. */ - else if (pid != (pid_t) INVALID_HANDLE_VALUE && pid != 0) - TerminateProcess ((HANDLE)pid, 1); -#else - else if (pid > 0) - kill (pid, SIGINT); -#endif + assuan_pipe_kill_server (entry_ctx); return NULL; } @@ -2122,7 +2110,6 @@ void agent_popup_message_stop (ctrl_t ctrl) { int rc; - pid_t pid; (void)ctrl; @@ -2135,26 +2122,10 @@ agent_popup_message_stop (ctrl_t ctrl) return; } - pid = assuan_get_pid (entry_ctx); - if (pid == (pid_t)(-1)) - ; /* No pid available can't send a kill. */ - else if (popup_finished) + if (popup_finished) ; /* Already finished and ready for joining. */ -#ifdef HAVE_W32_SYSTEM - /* Older versions of assuan set PID to 0 on Windows to indicate an - invalid value. */ - else if (pid != (pid_t) INVALID_HANDLE_VALUE - && pid != 0) - { - HANDLE process = (HANDLE) pid; - - /* Arbitrary error code. */ - TerminateProcess (process, 1); - } -#else - else if (pid > 0) - kill (pid, SIGINT); -#endif + else + assuan_pipe_kill_server (entry_ctx); /* Now wait for the thread to terminate. */ rc = npth_join (popup_tid, NULL); |