# # patch "res/res_agi.c" # from [f10428af1545961ad59af8fabad7fc896c287d66] # to [c7fb998f9c70d7e318b10bfd5dbffbb534776f6f] # --- res/res_agi.c +++ res/res_agi.c @@ -211,6 +211,7 @@ int audio[2]; int x; int res; + sigset_t signal_set; if (!strncasecmp(script, "agi://", 6)) return launch_netscript(script, argv, fds, efd, opid); @@ -266,9 +267,17 @@ } else { close(STDERR_FILENO + 1); } + + /* unblock important signal handlers */ + if(sigfillset(&signal_set) || pthread_sigmask(SIG_UNBLOCK, &signal_set, NULL)) { + ast_log(LOG_WARNING, "unable to unblock signals for AGI script: %s\n", strerror(errno)); + exit(1); + } + /* Close everything but stdin/out/error */ for (x=STDERR_FILENO + 2;x<1024;x++) close(x); + /* Execute script */ execv(script, argv); /* Can't use ast_log since FD's are closed */ @@ -1817,8 +1826,10 @@ } } /* Notify process */ - if (pid > -1) - kill(pid, SIGHUP); + if (pid > -1) { + if(kill(pid, SIGHUP)) + ast_log(LOG_WARNING, "unable to send SIGHUP to AGI process %d: %s\n", pid, strerror(errno)); + } fclose(readf); return returnstatus; }