summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Engestrom <[email protected]>2019-05-16 14:57:07 +0100
committerJuan A. Suarez Romero <[email protected]>2019-06-09 16:51:36 +0000
commitc025240f6c2c2f5e704691acf4a5450a6ae56cc9 (patch)
treecf73424d662d1326dfe0d1b97ae6d0a9499eec92
parent3301eeee515c43c0cab71e38c7641ef125184b4d (diff)
util/os_file: actually return the error read() gave us
Fixes: 316964709e21286c2af5 "util: add os_read_file() helper" Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]> (cherry picked from commit 7e35f20d44321b20777020ad067d39116d142013)
-rw-r--r--src/util/os_file.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/util/os_file.c b/src/util/os_file.c
index 246fd32fdf6..da17d12b50e 100644
--- a/src/util/os_file.c
+++ b/src/util/os_file.c
@@ -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);