aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-05-26 21:19:49 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-05-26 21:19:49 +0000
commitac80f396880402ab93e38c54cc1c92a91c3c1a75 (patch)
tree6b8e8c7345155893b316f35e8c71b14c95b425c5 /utils
parent51a19a149f0ea28efed4087f1a037c9cc67178b4 (diff)
Merged revisions 266146 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r266146 | tilghman | 2010-05-26 16:17:46 -0500 (Wed, 26 May 2010) | 21 lines 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/branches/1.6.2@266154 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 6d51143f5..fc6e2388d 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);