From 3e54765193083926873b55172db0282a2ff3eeee Mon Sep 17 00:00:00 2001 From: Belbo Date: Tue, 15 Aug 2017 21:51:47 +0200 Subject: [PATCH] Fixed loop condition in non_blocking_write() The while loop should be repeated, if the last write attempt was a partial write only. In this case, however, rc is greater than 0 (should be 1), not equal to 0. --- common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common.c b/common.c index 2949ebbb..36fa183c 100644 --- a/common.c +++ b/common.c @@ -723,9 +723,9 @@ uint64_t get_absolute_time_in_fp() { ssize_t non_blocking_write(int fd, const void *buf, size_t count) { void *ibuf = (void *)buf; size_t bytes_remaining = count; - int rc = 0; + int rc = 1; struct pollfd ufds[1]; - while ((bytes_remaining > 0) && (rc == 0)) { + while ((bytes_remaining > 0) && (rc > 0)) { // check that we can do some writing ufds[0].fd = fd; ufds[0].events = POLLOUT; -- 2.47.2