aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-05-26 21:17:46 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-05-26 21:17:46 +0000
commit01e42965e966c0c7ba28925edbfff5d3e703a7ce (patch)
tree7297c57218c0449f310d16e934adeacf9c9f30a1 /utils
parentd4c1a86eba4ed8c6a81d2c8d11fe2efba13eed6f (diff)
Merged revisions 266142 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r266142 | tilghman | 2010-05-26 16:11:44 -0500 (Wed, 26 May 2010) | 14 lines Use sigaction for signals which should persist past the initial trigger, not signal. If you call signal() in a Solaris signal handler, instead of just resetting the signal handler, it causes the signal to refire, because the signal is not marked as handled prior to the signal handler being called. This effectively causes Solaris to immediately exceed the threadstack in recursive signal handlers and crash. (closes issue #17000) Reported by: rmcgilvr Patches: 20100526__issue17000.diff.txt uploaded by tilghman (license 14) Tested by: rmcgilvr ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@266146 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'utils')
-rw-r--r--utils/extconf.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/utils/extconf.c b/utils/extconf.c
index c653f3176..21f85e92c 100644
--- a/utils/extconf.c
+++ b/utils/extconf.c
@@ -1258,14 +1258,18 @@ static void CB_RESET(void )
/*! \brief Keep track of how many threads are currently trying to wait*() on
* a child process */
static unsigned int safe_system_level = 0;
-static void *safe_system_prev_handler;
+static struct sigaction safe_system_prev_handler;
/*! \brief NULL handler so we can collect the child exit status */
-static void null_sig_handler(int sig)
+static void _null_sig_handler(int sig)
{
}
+static struct sigaction null_sig_handler = {
+ .sa_handler = _null_sig_handler,
+};
+
void ast_replace_sigchld(void);
void ast_replace_sigchld(void)
@@ -1275,9 +1279,9 @@ void ast_replace_sigchld(void)
level = safe_system_level++;
/* only replace the handler if it has not already been done */
- if (level == 0)
- safe_system_prev_handler = signal(SIGCHLD, null_sig_handler);
-
+ if (level == 0) {
+ sigaction(SIGCHLD, &null_sig_handler, &safe_system_prev_handler);
+ }
}
void ast_unreplace_sigchld(void);
@@ -1289,9 +1293,9 @@ void ast_unreplace_sigchld(void)
level = --safe_system_level;
/* only restore the handler if we are the last one */
- if (level == 0)
- signal(SIGCHLD, safe_system_prev_handler);
-
+ if (level == 0) {
+ sigaction(SIGCHLD, &safe_system_prev_handler, NULL);
+ }
}
int ast_safe_system(const char *s);