aboutsummaryrefslogtreecommitdiffstats
path: root/agent
diff options
context:
space:
mode:
Diffstat (limited to 'agent')
-rw-r--r--agent/ChangeLog5
-rw-r--r--agent/call-scd.c6
-rw-r--r--agent/gpg-agent.c26
3 files changed, 33 insertions, 4 deletions
diff --git a/agent/ChangeLog b/agent/ChangeLog
index e076675ae..c3798c143 100644
--- a/agent/ChangeLog
+++ b/agent/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-14 Werner Koch <[email protected]>
+
+ * gpg-agent.c (get_agent_scd_notify_event): Need to use a manual
+ reset event.
+
2008-09-29 Werner Koch <[email protected]>
* agent.h (GCRY_MD_USER): Rename to GCRY_MODULE_ID_USER.
diff --git a/agent/call-scd.c b/agent/call-scd.c
index 872ba3433..55f2d4ffb 100644
--- a/agent/call-scd.c
+++ b/agent/call-scd.c
@@ -378,8 +378,10 @@ start_scd (ctrl_t ctrl)
char buf[100];
#ifdef HAVE_W32_SYSTEM
- snprintf (buf, sizeof buf, "OPTION event-signal=%lx",
- (unsigned long)get_agent_scd_notify_event ());
+ /* Use estream snprintf due to a bug in mingw32 related to the l
+ modifier. */
+ estream_snprintf (buf, sizeof buf, "OPTION event-signal=%lx",
+ (unsigned long)get_agent_scd_notify_event ());
#else
snprintf (buf, sizeof buf, "OPTION event-signal=%d", SIGUSR2);
#endif
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index dc13c9908..bc3c43eaf 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -1268,12 +1268,34 @@ get_agent_scd_notify_event (void)
if (!the_event)
{
+ HANDLE h, h2;
SECURITY_ATTRIBUTES sa = { sizeof (SECURITY_ATTRIBUTES), NULL, TRUE};
- the_event = CreateEvent ( &sa, FALSE, FALSE, NULL);
- if (!the_event)
+ /* We need to use manual reset evet object due to the way our
+ w32-pth wait function works: If we would use an automatic
+ reset event we are not able to figure out which handle has
+ been signaled because at the time we single out the signaled
+ handles using WFSO the event has already been reset due to
+ the WFMO. */
+ h = CreateEvent (&sa, TRUE, FALSE, NULL);
+ if (!h)
log_error ("can't create scd notify event: %s\n", w32_strerror (-1) );
+ else if (!DuplicateHandle (GetCurrentProcess(), h,
+ GetCurrentProcess(), &h2,
+ EVENT_MODIFY_STATE|SYNCHRONIZE, TRUE, 0))
+ {
+ log_error ("setting syncronize for scd notify event failed: %s\n",
+ w32_strerror (-1) );
+ CloseHandle (h);
+ }
+ else
+ {
+ CloseHandle (h);
+ the_event = h2;
+ }
}
+
+ log_debug ("returning notify handle %p\n", the_event);
return the_event;
}
#endif /*HAVE_W32_SYSTEM*/