[asterisk-commits] russell: branch 1.4 r77788 - /branches/1.4/res/res_agi.c

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


Author: russell
Date: Mon Jul 30 14:13:31 2007
New Revision: 77788

URL: http://svn.digium.com/view/asterisk?view=rev&rev=77788
Log:
(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:
    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=77788&r1=77787&r2=77788
==============================================================================
--- branches/1.4/res/res_agi.c (original)
+++ branches/1.4/res/res_agi.c Mon Jul 30 14:13:31 2007
@@ -115,7 +115,7 @@
 	AGI_RESULT_HANGUP
 };
 
-static void agi_debug_cli(int fd, char *fmt, ...)
+static int agi_debug_cli(int fd, char *fmt, ...)
 {
 	char *stuff;
 	int res = 0;
@@ -129,9 +129,11 @@
 	} else {
 		if (agidebug)
 			ast_verbose("AGI Tx >> %s", stuff); /* \n provided by caller */
-		ast_carefulwrite(fd, stuff, strlen(stuff), 100);
+		res = ast_carefulwrite(fd, stuff, strlen(stuff), 100);
 		free(stuff);
 	}
+
+	return res;
 }
 
 /* launch_netscript: The fastagi handler.
@@ -210,8 +212,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 (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