]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Fixed loop condition in non_blocking_write() 611/head
authorBelbo <belbo@gmx.de>
Tue, 15 Aug 2017 19:51:47 +0000 (21:51 +0200)
committerBelbo <belbo@gmx.de>
Tue, 31 Oct 2017 22:19:22 +0000 (23:19 +0100)
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

index 2949ebbb01c509612f5b4c7cc49d1ba867cb0a2a..36fa183c841b88e3efe71a833c930f28e3086d81 100644 (file)
--- 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;