Sophie

Sophie

distrib > Mandriva > current > i586 > media > contrib-release-src > by-pkgid > ea7710e9d88b1b05b8d30c36cfe50a68 > files > 18

xcdroast-0.98-0.a15.39mdv2010.1.src.rpm

--- xcdroast-0.98alpha15/src/tools.c.linebuffer	2003-10-26 22:28:57.000000000 +0000
+++ xcdroast-0.98alpha15/src/tools.c	2004-07-12 12:24:36.134850404 +0100
@@ -596,8 +596,25 @@
 			if (rc == -1 && errno == EAGAIN) {
 				if (n == 1) 
 					return(-1);
-				else
+				else {
+					/* Partial line read.  Wait a
+					 * bit longer in case there's
+					 * more.  This does not fix
+					 * all the races in the
+					 * parsing code, but works
+					 * around them somewhat. */
+					struct timeval t;
+					fd_set set;
+					FD_ZERO(&set);
+					FD_SET(fd,&set);
+					t.tv_sec = 1;
+					t.tv_usec = 0;
+					if (select (fd+1, &set, NULL,
+						    NULL, &t) > 0)
+						continue;
+
 					break;
+				}	
 			}	
                         return(-1);     /* error */
 		}