terminate on reading 0 bytes
[satlib.git] / glucose-syrup / incremental / Main.cc
index 7a69d767866cc9582b52fb56d59cfdbc1b16b32c..6b7ed12b82935246a1c696f4f11cadb91f59088a 100644 (file)
@@ -71,13 +71,13 @@ int getInt() {
     offset = 0;
     do {
       ptr=read(0, buffer, sizeof(int)*IS_BUFFERSIZE);
-      if (ptr == -1)
+      if (ptr == -1 || ptr == 0)
         exit(-1);
     } while(ptr==0);
     ssize_t bytestoread=(4-(ptr & 3)) & 3;
     while(bytestoread != 0) {
       ssize_t p=read(0, &((char *)buffer)[ptr], bytestoread);
-      if (p == -1)
+      if (p == -1 || p == 0)
         exit(-1);
       bytestoread -= p;
       ptr += p;