summaryrefslogtreecommitdiff
path: root/main/asterisk.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2011-06-27 16:32:19 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2011-06-27 16:32:19 +0000
commitdb15b0010cc8c31faa25d235bd50091ff5e79dd5 (patch)
treefbc2bbcc7ec7534b9ce5586253f8d2a0cb5cc688 /main/asterisk.c
parent04226479b3954380895fd79b9443de3e2a5b2ab8 (diff)
Merged revisions 324955 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r324955 | tilghman | 2011-06-27 11:30:50 -0500 (Mon, 27 Jun 2011) | 5 lines Save and restore errno from within signal handlers. This is recommended by the POSIX standard, as well as by the sigaction(2) manpage for various platforms that we support (e.g. Mac OS X). ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@324961 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/asterisk.c')
-rw-r--r--main/asterisk.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index 7b93294ca..a325fec85 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -1484,7 +1484,7 @@ static struct sigaction urg_handler = {
static void _hup_handler(int num)
{
- int a = 0;
+ int a = 0, save_errno = errno;
if (option_verbose > 1)
printf("Received HUP signal -- Reloading configs\n");
if (restartnow)
@@ -1495,6 +1495,7 @@ static void _hup_handler(int num)
fprintf(stderr, "hup_handler: write() failed: %s\n", strerror(errno));
}
}
+ errno = save_errno;
}
static struct sigaction hup_handler = {
@@ -1505,7 +1506,7 @@ static struct sigaction hup_handler = {
static void _child_handler(int sig)
{
/* Must not ever ast_log or ast_verbose within signal handler */
- int n, status;
+ int n, status, save_errno = errno;
/*
* Reap all dead children -- not just one
@@ -1514,6 +1515,7 @@ static void _child_handler(int sig)
;
if (n == 0 && option_debug)
printf("Huh? Child handler, but nobody there?\n");
+ errno = save_errno;
}
static struct sigaction child_handler = {