2010-11-11 Werner Koch * agent.h (opt): Add field SIGUSR2_ENABLED. * gpg-agent.c (handle_connections): Set that flag. * call-scd.c (start_scd): Enable events depending on this flag. Index: agent/agent.h =================================================================== --- agent/agent.h (revision 5468) +++ agent/agent.h (working copy) @@ -58,6 +58,9 @@ /* True if we are listening on the standard socket. */ int use_standard_socket; + /* True if we handle sigusr2. */ + int sigusr2_enabled; + /* Environment setting gathered at program start or changed using the Assuan command UPDATESTARTUPTTY. */ session_env_t startup_env; * gpg-agent.c (create_socket_name): Use TMPDIR. Change callers. Index: agent/gpg-agent.c =================================================================== --- agent/gpg-agent.c (revision 5470) +++ agent/gpg-agent.c (working copy) @@ -1894,6 +1894,10 @@ #endif time_ev = NULL; + /* Set a flag to tell call-scd.c that it may enable event + notifications. */ + opt.sigusr2_enabled = 1; + FD_ZERO (&fdset); FD_SET (FD2INT (listen_fd), &fdset); nfd = FD2INT (listen_fd); Index: agent/call-scd.c =================================================================== --- agent/call-scd.c (revision 5468) +++ agent/call-scd.c (working copy) @@ -399,17 +399,18 @@ /* Tell the scdaemon we want him to send us an event signal. We don't support this for W32CE. */ #ifndef HAVE_W32CE_SYSTEM - { - char buf[100]; - + if (opt.sigusr2_enabled) + { + char buf[100]; + #ifdef HAVE_W32_SYSTEM - snprintf (buf, sizeof buf, "OPTION event-signal=%lx", - (unsigned long)get_agent_scd_notify_event ()); + 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); + snprintf (buf, sizeof buf, "OPTION event-signal=%d", SIGUSR2); #endif - assuan_transact (ctx, buf, NULL, NULL, NULL, NULL, NULL, NULL); - } + assuan_transact (ctx, buf, NULL, NULL, NULL, NULL, NULL, NULL); + } #endif /*HAVE_W32CE_SYSTEM*/ primary_scd_ctx = ctx;