[asterisk-commits] tilghman: trunk r324961 - in /trunk: ./ main/asterisk.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 27 11:32:24 CDT 2011


Author: tilghman
Date: Mon Jun 27 11:32:19 2011
New Revision: 324961

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=324961
Log:
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).
........

Modified:
    trunk/   (props changed)
    trunk/main/asterisk.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: trunk/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/asterisk.c?view=diff&rev=324961&r1=324960&r2=324961
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Mon Jun 27 11:32:19 2011
@@ -1484,7 +1484,7 @@
 
 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 @@
 			fprintf(stderr, "hup_handler: write() failed: %s\n", strerror(errno));
 		}
 	}
+	errno = save_errno;
 }
 
 static struct sigaction hup_handler = {
@@ -1505,7 +1506,7 @@
 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 @@
 		;
 	if (n == 0 && option_debug)	
 		printf("Huh?  Child handler, but nobody there?\n");
+	errno = save_errno;
 }
 
 static struct sigaction child_handler = {




More information about the asterisk-commits mailing list