chiark / gitweb /
gpg agent lockup fix: Interrupt main loop when active_connections_value==0
[gnupg2.git] / agent / gpg-agent.c
index 1f92661ed661dff1be85edf61542b6a9bfce6387..121bb0ed4f6a7e8b9d3486c4855e3811776db57e 100644 (file)
@@ -316,10 +316,10 @@ static int startup_signal_mask_valid;
 #endif
 
 /* Flag to indicate that a shutdown was requested.  */
-static int shutdown_pending;
+static int shutdown_pending; /* xxx threaded accesses lack locking */
 
 /* Counter for the currently running own socket checks.  */
-static int check_own_socket_running;
+static int check_own_socket_running; /* xxx threaded accesses lack locking */
 
 /* Flags to indicate that check_own_socket shall not be called.  */
 static int disable_check_own_socket;
@@ -328,7 +328,7 @@ static int disable_check_own_socket;
 static int is_supervised;
 
 /* Flag to inhibit socket removal in cleanup.  */
-static int inhibit_socket_removal;
+static int inhibit_socket_removal; /* xxx threaded accesses lack locking */
 
 /* It is possible that we are currently running under setuid permissions */
 static int maybe_setuid = 1;
@@ -2029,6 +2029,8 @@ adjust_agent_active_connections (int delta)
 {
   lock_active_connections();
   active_connections_value += delta;
+  if (active_connections_value == 0)
+    interrupt_main_thread_loop ();
   unlock_active_connections();
 }