From 6368b8d86ecabbe09f646116c2cfa44237e9285c Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Wed, 14 May 2008 21:39:47 +0000 Subject: [PATCH] Merged revisions 116467 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r116467 | tilghman | 2008-05-14 16:39:06 -0500 (Wed, 14 May 2008) | 15 lines Merged revisions 116466 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r116466 | tilghman | 2008-05-14 16:38:09 -0500 (Wed, 14 May 2008) | 7 lines 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 ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@116468 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- res/res_agi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/res/res_agi.c b/res/res_agi.c index cd3bc2a2e5..ffc82cea8a 100644 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -2699,9 +2699,13 @@ static enum agi_result run_agi(struct ast_channel *chan, char *request, AGI *agi 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;