From eb7d2d3ac2a82570c3d413f61d3832035e9d11dd Mon Sep 17 00:00:00 2001
From: Jamie Zawinski <jwz@jwz.org>
Date: Sat, 24 Oct 2015 22:58:02 +0900
Subject: [PATCH] Modify sigchld_hander / in_signal_hander_p mechanism
---
driver/subprocs.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/driver/subprocs.c b/driver/subprocs.c
index 1969724..51332aa 100644
--- a/driver/subprocs.c
+++ b/driver/subprocs.c
@@ -387,6 +387,11 @@ block_sigchld (void)
void
unblock_sigchld (void)
{
+ if (block_sigchld_handler <= 0)
+ abort();
+
+ if (block_sigchld_handler <= 1) /* only unblock if count going to 0 */
+ {
#ifdef HAVE_SIGACTION
struct sigaction sa;
sigset_t child_set;
@@ -402,6 +407,7 @@ unblock_sigchld (void)
#else /* !HAVE_SIGACTION */
signal(SIGPIPE, SIG_DFL);
#endif /* !HAVE_SIGACTION */
+ }
block_sigchld_handler--;
}
@@ -415,7 +421,7 @@ kill_job (saver_info *si, pid_t pid, int signal)
clean_job_list();
- if (block_sigchld_handler)
+ if (in_signal_handler_p)
/* This function should not be called from the signal handler. */
abort();
--
2.5.0