1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

scd: Fix send_client_notifications for Windows.

* scd/command.c (send_client_notifications): Don't use assuan_get_pid
for Windows.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2023-05-17 15:28:01 +09:00
parent d221062769
commit b789ada2b0
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054

View File

@ -2942,10 +2942,10 @@ void
send_client_notifications (card_t card, int removal) send_client_notifications (card_t card, int removal)
{ {
struct { struct {
pid_t pid;
#ifdef HAVE_W32_SYSTEM #ifdef HAVE_W32_SYSTEM
HANDLE handle; HANDLE handle;
#else #else
pid_t pid;
int signo; int signo;
#endif #endif
} killed[50]; } killed[50];
@ -2965,10 +2965,10 @@ send_client_notifications (card_t card, int removal)
if (sl->ctrl_backlink && sl->ctrl_backlink->card_ctx == card) if (sl->ctrl_backlink && sl->ctrl_backlink->card_ctx == card)
{ {
pid_t pid;
#ifdef HAVE_W32_SYSTEM #ifdef HAVE_W32_SYSTEM
HANDLE handle; HANDLE handle;
#else #else
pid_t pid;
int signo; int signo;
#endif #endif
@ -2983,32 +2983,29 @@ send_client_notifications (card_t card, int removal)
if (!sl->event_signal || !sl->assuan_ctx) if (!sl->event_signal || !sl->assuan_ctx)
continue; continue;
pid = assuan_get_pid (sl->assuan_ctx);
#ifdef HAVE_W32_SYSTEM #ifdef HAVE_W32_SYSTEM
handle = sl->event_signal; handle = sl->event_signal;
for (kidx=0; kidx < killidx; kidx++) for (kidx=0; kidx < killidx; kidx++)
if (killed[kidx].pid == pid if (killed[kidx].handle == handle)
&& killed[kidx].handle == handle)
break; break;
if (kidx < killidx) if (kidx < killidx)
log_info ("event %p (%p) already triggered for client %d\n", log_info ("event %p already triggered for client\n",
sl->event_signal, handle, (int)pid); sl->event_signal);
else else
{ {
log_info ("triggering event %p (%p) for client %d\n", log_info ("triggering event %p for client\n",
sl->event_signal, handle, (int)pid); sl->event_signal);
if (!SetEvent (handle)) if (!SetEvent (handle))
log_error ("SetEvent(%p) failed: %s\n", log_error ("SetEvent(%p) failed: %s\n",
sl->event_signal, w32_strerror (-1)); sl->event_signal, w32_strerror (-1));
if (killidx < DIM (killed)) if (killidx < DIM (killed))
{ {
killed[killidx].pid = pid;
killed[killidx].handle = handle; killed[killidx].handle = handle;
killidx++; killidx++;
} }
} }
#else /*!HAVE_W32_SYSTEM*/ #else /*!HAVE_W32_SYSTEM*/
pid = assuan_get_pid (sl->assuan_ctx);
signo = sl->event_signal; signo = sl->event_signal;
if (pid != (pid_t)(-1) && pid && signo > 0) if (pid != (pid_t)(-1) && pid && signo > 0)