Fix double close of file descriptor (bug #1473)
authorMark Spencer <markster@digium.com>
Fri, 23 Apr 2004 04:38:11 +0000 (04:38 +0000)
committerMark Spencer <markster@digium.com>
Fri, 23 Apr 2004 04:38:11 +0000 (04:38 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2751 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_agi.c

index d7cd468..98021fe 100755 (executable)
@@ -1288,6 +1288,7 @@ static int run_agi(struct ast_channel *chan, char *request, AGI *agi, int pid, i
        if (!(readf = fdopen(agi->ctrl, "r"))) {
                ast_log(LOG_WARNING, "Unable to fdopen file descriptor\n");
                kill(pid, SIGHUP);
+               close(agi->ctrl);
                return -1;
        }
        setlinebuf(readf);
@@ -1465,7 +1466,6 @@ static int agi_exec_full(struct ast_channel *chan, void *data, int enhanced, int
                agi.ctrl = fds[0];
                agi.audio = efd;
                res = run_agi(chan, tmp, &agi, pid, dead);
-               close(fds[0]);
                close(fds[1]);
                if (efd > -1)
                        close(efd);