diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-05-14 21:38:09 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-05-14 21:38:09 +0000 |
commit | 3fbde81a49defa2822ca24c4aa7f32966ca8ac9f (patch) | |
tree | 8a44ec929f9903f062a6a4282d0b3faefee25ba2 /res/res_agi.c | |
parent | 848841973a5c5b8d2de336ed32f5b4ab80ca8d79 (diff) |
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/branches/1.4@116466 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_agi.c')
-rw-r--r-- | res/res_agi.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/res/res_agi.c b/res/res_agi.c index 4b23b0110..ea1f329d2 100644 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -1934,9 +1934,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; |