From 00598b79d3bc3d604a611ccd19a0f23f5f997597 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Mon, 9 Mar 2015 15:02:40 -0700 Subject: [PATCH] terminate on reading 0 bytes --- glucose-syrup/incremental/Main.cc | 4 ++-- zchaff64/inc_solver.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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; -- 2.34.1