From: bdemsky Date: Mon, 9 Mar 2015 22:02:40 +0000 (-0700) Subject: terminate on reading 0 bytes X-Git-Url: http://plrg.eecs.uci.edu/git/?p=satlib.git;a=commitdiff_plain;h=00598b79d3bc3d604a611ccd19a0f23f5f997597;ds=sidebyside terminate on reading 0 bytes --- diff --git a/glucose-syrup/incremental/Main.cc b/glucose-syrup/incremental/Main.cc index 7a69d76..6b7ed12 100644 --- a/glucose-syrup/incremental/Main.cc +++ b/glucose-syrup/incremental/Main.cc @@ -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; diff --git a/zchaff64/inc_solver.cpp b/zchaff64/inc_solver.cpp index 826f054..eda4eb0 100644 --- a/zchaff64/inc_solver.cpp +++ b/zchaff64/inc_solver.cpp @@ -72,13 +72,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;