src/lib/net.c 1.78
1.78 2009/12/18 22:48:27 angie
Fixed comparison edge condition (not a huge problem, it just set tv_{sec,usec} to {0,1000000} not {1,0}) and more importantly, added a missing EOF check that was allowing unexpected EOF from FTP to result in inf. loop.
Index: src/lib/net.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/net.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -b -B -U 4 -r1.77 -r1.78
--- src/lib/net.c 13 Nov 2009 06:35:45 -0000 1.77
+++ src/lib/net.c 18 Dec 2009 22:48:27 -0000 1.78
@@ -381,9 +381,9 @@
int readyCount;
for (;;)
{
- if (microseconds > 1000000)
+ if (microseconds >= 1000000)
{
tv.tv_sec = microseconds/1000000;
tv.tv_usec = microseconds%1000000;
}
@@ -458,8 +458,10 @@
isdigit(startLastLine[2]) &&
startLastLine[3]==' ')
break;
+ if (readSize == 0)
+ break; // EOF
/* must be some text info we can't use, ignore it till we get status code */
}