util/os_file: actually return the error read() gave us

Fixes: 316964709e "util: add os_read_file() helper"
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit 7e35f20d44)
This commit is contained in:
Eric Engestrom 2019-05-16 14:57:07 +01:00 committed by Juan A. Suarez Romero
parent 3301eeee51
commit c025240f6c

View 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);