Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Fix error handling in MC_process{read,write}
authorGabriel Corona <gabriel.corona@loria.fr>
Thu, 11 Dec 2014 13:51:39 +0000 (14:51 +0100)
committerGabriel Corona <gabriel.corona@loria.fr>
Thu, 11 Dec 2014 14:00:03 +0000 (15:00 +0100)
src/mc/mc_process.c

index 900a6f8..d771039 100644 (file)
@@ -254,7 +254,7 @@ static ssize_t pread_whole(int fd, void *buf, size_t count, off_t offset)
   ssize_t real_count = count;
   while (count) {
     ssize_t res = pread(fd, buffer, count, offset);
-    if (res >= 0) {
+    if (res > 0) {
       count  -= res;
       buffer += res;
       offset += res;
@@ -273,7 +273,7 @@ static ssize_t pwrite_whole(int fd, const void *buf, size_t count, off_t offset)
   ssize_t real_count = count;
   while (count) {
     ssize_t res = pwrite(fd, buffer, count, offset);
-    if (res >= 0) {
+    if (res > 0) {
       count  -= res;
       buffer += res;
       offset += res;