[asterisk-commits] tilghman: branch 1.4 r116466 - /branches/1.4/res/res_agi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 14 16:38:09 CDT 2008


Author: tilghman
Date: Wed May 14 16:38:09 2008
New Revision: 116466

URL: http://svn.digium.com/view/asterisk?view=rev&rev=116466
Log:
Avoid zombies when the channel exits before the AGI.
(closes issue #12648)
 Reported by: gkloepfer
 Patches: 
       20080514__bug12648.diff.txt uploaded by Corydon76 (license 14)
 Tested by: gkloepfer

Modified:
    branches/1.4/res/res_agi.c

Modified: branches/1.4/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/res/res_agi.c?view=diff&rev=116466&r1=116465&r2=116466
==============================================================================
--- branches/1.4/res/res_agi.c (original)
+++ branches/1.4/res/res_agi.c Wed May 14 16:38:09 2008
@@ -1934,9 +1934,13 @@
 	if (pid > -1) {
 		const char *sighup = pbx_builtin_getvar_helper(chan, "AGISIGHUP");
 		if (ast_strlen_zero(sighup) || !ast_false(sighup)) {
-			if (kill(pid, SIGHUP))
+			if (kill(pid, SIGHUP)) {
 				ast_log(LOG_WARNING, "unable to send SIGHUP to AGI process %d: %s\n", pid, strerror(errno));
+			} else { /* Give the process a chance to die */
+				usleep(1);
+			}
 		}
+		waitpid(pid, status, WNOHANG);
 	}
 	fclose(readf);
 	return returnstatus;




More information about the asterisk-commits mailing list