Restore sigmask at fork.
authorNIIBE Yutaka <gniibe@fsij.org>
Wed, 3 Jul 2013 08:06:49 +0000 (17:06 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Wed, 3 Jul 2013 08:06:49 +0000 (17:06 +0900)
* src/npth-sigev.c (restore_sigmask_for_child_process): New.
(npth_sigev_fini): Register restore_sigmask_for_child_process.

src/npth-sigev.c

index f1271d1..aab977e 100644 (file)
@@ -126,6 +126,13 @@ npth_sigev_add (int signum)
 }
 
 
+static void
+restore_sigmask_for_child_process (void)
+{
+  pthread_sigmask (SIG_SETMASK, &sigev_unblock, NULL);
+}
+
+
 /* Finish the list of watched signals.  This starts to block them,
    too.  */
 void
@@ -133,6 +140,7 @@ npth_sigev_fini (void)
 {
   /* Block the interesting signals.  */
   pthread_sigmask (SIG_SETMASK, &sigev_block, NULL);
+  pthread_atfork (NULL, NULL, restore_sigmask_for_child_process);
 }