[asterisk-commits] russell: branch 1.4 r80360 - /branches/1.4/res/res_agi.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Aug 22 14:53:30 CDT 2007
Author: russell
Date: Wed Aug 22 14:53:30 2007
New Revision: 80360
URL: http://svn.digium.com/view/asterisk?view=rev&rev=80360
Log:
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:
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=80360&r1=80359&r2=80360
==============================================================================
--- branches/1.4/res/res_agi.c (original)
+++ branches/1.4/res/res_agi.c Wed Aug 22 14:53:30 2007
@@ -1866,8 +1866,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 = -1;
@@ -1879,6 +1885,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