From: Belbo Date: Tue, 15 Aug 2017 19:51:47 +0000 (+0200) Subject: Fixed loop condition in non_blocking_write() X-Git-Tag: 3.2d13~26^2 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F611%2Fhead;p=thirdparty%2Fshairport-sync.git 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. --- 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;