[asterisk-commits] russell: trunk r80361 - in /trunk: ./ res/res_agi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 22 14:54:53 CDT 2007


Author: russell
Date: Wed Aug 22 14:54:52 2007
New Revision: 80361

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

........
r80360 | russell | 2007-08-22 14:53:30 -0500 (Wed, 22 Aug 2007) | 5 lines

Juggie in #asterisk-dev was reporting problems where fgets would return
without reading  the whole line when using fastagi.  When this happens,
errno was set to EINTR or EAGAIN.  This patch accounts for the possibility
and lets fgets continue in that case.

........

Modified:
    trunk/   (props changed)
    trunk/res/res_agi.c

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

Modified: trunk/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_agi.c?view=diff&rev=80361&r1=80360&r2=80361
==============================================================================
--- trunk/res/res_agi.c (original)
+++ trunk/res/res_agi.c Wed Aug 22 14:54:52 2007
@@ -1902,8 +1902,14 @@
 				ast_frfree(f);
 			}
 		} else if (outfd > -1) {
+			size_t len;
 			retry = RETRY;
-			if (!fgets(buf, sizeof(buf), readf)) {
+			buf[0] = '\0';
+retry_fgets:
+			len = strlen(buf);
+			if (!fgets(buf + len, sizeof(buf) - len, readf)) {
+				if (!feof(readf) && (errno == EINTR || errno == EAGAIN))
+					goto retry_fgets;
 				/* Program terminated */
 				if (returnstatus && returnstatus != AST_PBX_KEEPALIVE)
 					returnstatus = -1;
@@ -1914,6 +1920,8 @@
 				pid = -1;
 				break;
 			}
+			if (errno == EINTR || errno == EAGAIN)
+				goto retry_fgets;
 			/* get rid of trailing newline, if any */
 			if (*buf && buf[strlen(buf) - 1] == '\n')
 				buf[strlen(buf) - 1] = 0;




More information about the asterisk-commits mailing list