summaryrefslogtreecommitdiff
path: root/os-posix.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-09-10 13:47:21 -0400
committerpommicket <pommicket@gmail.com>2023-09-10 13:47:21 -0400
commitfeee83bf24564212832fd113e594a17498c87c21 (patch)
tree91fb15b718f9716b7b35dd871d687fb45ac0dad0 /os-posix.c
parent6586f9e66d87017984f57b3b4579c78897ba66f2 (diff)
swap return 0 and -1 for process_read/socket_read
for consistency with process_write/socket_write
Diffstat (limited to 'os-posix.c')
-rw-r--r--os-posix.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/os-posix.c b/os-posix.c
index 32c1853..6b274fb 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -285,10 +285,8 @@ static long long read_fd(int fd, char *error, size_t error_size, char *data, siz
ssize_t bytes_read = read(fd, data + so_far, size - so_far);
if (bytes_read > 0) {
so_far += (size_t)bytes_read;
- } else if (bytes_read == 0) {
+ } else if (bytes_read == 0 || errno == EAGAIN || errno == EWOULDBLOCK) {
return (long long)so_far;
- } else if (errno == EAGAIN || errno == EWOULDBLOCK) {
- return so_far == 0 ? -1 : (long long)so_far;
} else if (errno == EPIPE) {
return -1;
} else {