aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_agi.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-14 21:39:06 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-14 21:39:06 +0000
commit79196d77088174f6775f27021b0c14419cdd9c8f (patch)
tree4785e7feeee71d16d1568f399408996b456f560f /res/res_agi.c
parente1a060a62cba034d55db28717c316be4acc50d59 (diff)
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: http://svn.digium.com/svn/asterisk/trunk@116467 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_agi.c')
-rw-r--r--res/res_agi.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/res/res_agi.c b/res/res_agi.c
index 953d4927a..ae8739136 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -2681,9 +2681,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;