[asterisk-commits] tilghman: branch 1.4 r114195 - /branches/1.4/res/res_agi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 17 07:56:39 CDT 2008


Author: tilghman
Date: Thu Apr 17 07:56:38 2008
New Revision: 114195

URL: http://svn.digium.com/view/asterisk?view=rev&rev=114195
Log:
Add special case for when the agi cannot be executed, to comply with the documentation that
we return failure in that case.
(closes issue #12462)
 Reported by: fmueller
 Patches: 
       20080416__bug12462.diff.txt uploaded by Corydon76 (license 14)
 Tested by: fmueller

Modified:
    branches/1.4/res/res_agi.c

Modified: branches/1.4/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/res/res_agi.c?view=diff&rev=114195&r1=114194&r2=114195
==============================================================================
--- branches/1.4/res/res_agi.c (original)
+++ branches/1.4/res/res_agi.c Thu Apr 17 07:56:38 2008
@@ -346,6 +346,8 @@
 		execv(script, argv);
 		/* Can't use ast_log since FD's are closed */
 		fprintf(stdout, "verbose \"Failed to execute '%s': %s\" 2\n", script, strerror(errno));
+		/* Special case to set status of AGI to failure */
+		fprintf(stdout, "failure\n");
 		fflush(stdout);
 		_exit(1);
 	}
@@ -1904,6 +1906,12 @@
 				break;
 			}
 
+			/* Special case for inability to execute child process */
+			if (*buf && strncasecmp(buf, "failure", 7) == 0) {
+				returnstatus = AGI_RESULT_FAILURE;
+				break;
+			}
+
 			/* get rid of trailing newline, if any */
 			if (*buf && buf[strlen(buf) - 1] == '\n')
 				buf[strlen(buf) - 1] = 0;
@@ -2047,6 +2055,7 @@
 		}
 	}
 #endif
+	ast_replace_sigchld();
 	res = launch_script(argv[0], argv, fds, enhanced ? &efd : NULL, &pid);
 	if (res == AGI_RESULT_SUCCESS || res == AGI_RESULT_SUCCESS_FAST) {
 		int status = 0;
@@ -2062,8 +2071,8 @@
 			close(fds[1]);
 		if (efd > -1)
 			close(efd);
-		ast_unreplace_sigchld();
-	}
+	}
+	ast_unreplace_sigchld();
 	ast_module_user_remove(u);
 
 	switch (res) {




More information about the asterisk-commits mailing list