[asterisk-commits] russell: trunk r77789 - in /trunk: ./ include/asterisk/agi.h res/res_agi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 30 14:18:24 CDT 2007


Author: russell
Date: Mon Jul 30 14:18:24 2007
New Revision: 77789

URL: http://svn.digium.com/view/asterisk?view=rev&rev=77789
Log:
Merged revisions 77788 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r77788 | russell | 2007-07-30 14:13:31 -0500 (Mon, 30 Jul 2007) | 10 lines

(closes issue #10279)
Reported by: seanbright
Patches:
      res_agi.carefulwrite.1.4.07252007.patch uploaded by seanbright (license 71)
      res_agi.carefulwrite.trunk.07252007.patch uploaded by seanbright (license 71)

Allow the "agi_network: yes" line to be printed out in the AGI debug output.
Also, allow partial writes to be handled when writing out this line just like
it is for all of the others.

........

Modified:
    trunk/   (props changed)
    trunk/include/asterisk/agi.h
    trunk/res/res_agi.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/include/asterisk/agi.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/agi.h?view=diff&rev=77789&r1=77788&r2=77789
==============================================================================
--- trunk/include/asterisk/agi.h (original)
+++ trunk/include/asterisk/agi.h Mon Jul 30 14:18:24 2007
@@ -51,7 +51,7 @@
 	AST_LIST_ENTRY(agi_command) list;
 } agi_command;
 
-void ast_agi_fdprintf(int fd, char *fmt, ...);
+int ast_agi_fdprintf(int fd, char *fmt, ...);
 int ast_agi_register(struct ast_module *mod, agi_command *cmd);
 int ast_agi_unregister(struct ast_module *mod, agi_command *cmd);
 void ast_agi_register_multiple(struct ast_module *mod, agi_command *cmd, int len);

Modified: trunk/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_agi.c?view=diff&rev=77789&r1=77788&r2=77789
==============================================================================
--- trunk/res/res_agi.c (original)
+++ trunk/res/res_agi.c Mon Jul 30 14:18:24 2007
@@ -115,7 +115,7 @@
 
 static agi_command *find_command(char *cmds[], int exact);
 
-void ast_agi_fdprintf(int fd, char *fmt, ...)
+int ast_agi_fdprintf(int fd, char *fmt, ...)
 {
 	char *stuff;
 	int res = 0;
@@ -127,13 +127,15 @@
 
 	if (res == -1) {
 		ast_log(LOG_ERROR, "Out of memory\n");
-		return;
+		return -1;
 	}
 
 	if (agidebug)
 		ast_verbose("AGI Tx >> %s", stuff);
 	ast_carefulwrite(fd, stuff, strlen(stuff), 100);
 	ast_free(stuff);
+
+	return res;
 }
 
 /* launch_netscript: The fastagi handler.
@@ -205,8 +207,8 @@
 			return AGI_RESULT_FAILURE;
 		}
 	}
-	/* XXX in theory should check for partial writes... */
-	while (write(s, "agi_network: yes\n", strlen("agi_network: yes\n")) < 0) {
+
+	if (ast_agi_fdprintf(s, "agi_network: yes\n") < 0) {
 		if (errno != EINTR) {
 			ast_log(LOG_WARNING, "Connect to '%s' failed: %s\n", agiurl, strerror(errno));
 			close(s);




More information about the asterisk-commits mailing list