Popup_message_stop

NIIBE Yutaka gniibe at fsij.org
Thu Jan 31 08:57:54 CET 2013


On 2013-01-24 at 13:22 +0900, NIIBE Yutaka wrote:
> On 2013-01-15 at 12:06 +0900, NIIBE Yutaka wrote:
> > I am bitten by my own change of:
> > 
> >     commit f6251c0d0af92331388f5e9bcd1750cbadcaca8f
> >     Author: NIIBE Yutaka <gniibe at fsij.org>
> >     Date:   Fri Dec 16 09:07:56 2011 +0900
> > 
> >         Don't kill pinentry by SIGKILL but let it quit by SIGINT.
> > 
> >         * agent/call-pinentry.c (agent_popup_message_stop): To pinentry, send
> >           SIGINT (was: SIGKILL).
> > 
> > The window of pinentry doesn't pop down, now.
> > 
> > This change was done because of pinentry-curses.  With
> > pinentry-curses, when it is killed by SIGINT, terminal gets confused.

For 2.0 branch, it is signal mask and signal handler setting.

Here is a patch to fix the original issue in 2.0.  Built and tested
(with VASCO reader).

diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
index 2483019..c945c13 100644
--- a/agent/call-pinentry.c
+++ b/agent/call-pinentry.c
@@ -170,6 +170,16 @@ static void
 atfork_cb (void *opaque, int where)
 {
   ctrl_t ctrl = opaque;
+#ifndef HAVE_W32_SYSTEM
+  struct sigaction sa;
+
+  /* Pop up message should be able to be killed by SIGINT.  */
+  sigemptyset (&sa.sa_mask);
+  sa.sa_handler = SIG_DFL;
+  sa.sa_flags = 0;
+  sigaction (SIGINT, &sa, NULL);
+  sigprocmask (SIG_SETMASK, &sa.sa_mask, NULL); /* Unblock all signals.  */
+#endif
 
   if (!where)
     {
@@ -1159,8 +1169,7 @@ agent_popup_message_stop (ctrl_t ctrl)
         assuan_set_flag (entry_ctx, ASSUAN_NO_WAITPID, 1);
     }
   else if (pid > 0)
-    kill (pid, SIGKILL);  /* Need to use SIGKILL due to bad
-                             interaction of SIGINT with Pth. */
+    kill (pid, SIGINT);
 #endif
 
   /* Now wait for the thread to terminate. */
-- 





More information about the Gnupg-devel mailing list