fix buffered read going into inf recursion loop
authorsheepluva
Tue, 05 Sep 2017 21:15:25 +0200
changeset 12453 89423b1db329
parent 12452 e18cfe90e4e2
child 12454 a675a94b5cc1
fix buffered read going into inf recursion loop
misc/libphysfs/physfs.c
--- a/misc/libphysfs/physfs.c	Tue Sep 05 20:46:40 2017 +0200
+++ b/misc/libphysfs/physfs.c	Tue Sep 05 21:15:25 2017 +0200
@@ -2588,20 +2588,20 @@
     {
         /* leave buffer empty, go right to output instead. */
         rc = io->read(io, buffer, len);
-        if (rc < 0)
+        if (rc <= 0)
             return ((retval == 0) ? rc : retval);
         return retval + rc;
     } /* if */
 
     /* need less than buffer can take. Fill buffer. */
     rc = io->read(io, fh->buffer, fh->bufsize);
-    if (rc < 0)
+    if (rc <= 0)
         return ((retval == 0) ? rc : retval);
 
     assert(fh->bufpos == 0);
     fh->buffill = (PHYSFS_uint32) rc;
     rc = doBufferedRead(fh, buffer, len);  /* go from the start, again. */
-    if (rc < 0)
+    if (rc <= 0)
         return ((retval == 0) ? rc : retval);
 
     return retval + rc;