util/os_file: actually return the error read() gave us
authorEric Engestrom <eric.engestrom@intel.com>
Thu, 16 May 2019 13:57:07 +0000 (14:57 +0100)
committerEric Engestrom <eric@engestrom.ch>
Sun, 9 Jun 2019 13:14:13 +0000 (13:14 +0000)
Fixes: 316964709e21286c2af5 "util: add os_read_file() helper"
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/util/os_file.c

index 246fd32fdf64408fe99627ca52729cf4ea9b6857..da17d12b50e5d67e5ea89a59da3397fa131f7214 100644 (file)
@@ -29,8 +29,10 @@ readN(int fd, char *buf, size_t len)
       if (ret == -EINTR || ret == -EAGAIN)
          continue;
 
-      if (ret <= 0)
+      if (ret <= 0) {
+         err = ret;
          break;
+      }
 
       total += ret;
    } while (total != len);