Skip to content

Commit 27c6729

Browse files
committed
Merge branch 'jk/read-in-full-stops-on-error'
* jk/read-in-full-stops-on-error: read_in_full: always report errors
2 parents 2cd517c + 56d7c27 commit 27c6729

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

wrapper.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,10 @@ ssize_t read_in_full(int fd, void *buf, size_t count)
148148

149149
while (count > 0) {
150150
ssize_t loaded = xread(fd, p, count);
151-
if (loaded <= 0)
152-
return total ? total : loaded;
151+
if (loaded < 0)
152+
return -1;
153+
if (loaded == 0)
154+
return total;
153155
count -= loaded;
154156
p += loaded;
155157
total += loaded;

0 commit comments

Comments
 (0)