summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2010-05-26 21:17:46 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2010-05-26 21:17:46 +0000
commitfb80119b87efc5ca0e8ee439ef70149601f4f24a (patch)
tree7297c57218c0449f310d16e934adeacf9c9f30a1 /utils
parent70a1bf31425daaa003c29af08f400f8df0623712 (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: https://origsvn.digium.com/svn/asterisk/trunk@266146 65c4cc65-6c06-0410-ace0-fbb531ad65f3
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);