]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Improve error reporting in non-blocking write code
authorMike Brady <mikebrady@eircom.net>
Fri, 7 Apr 2017 17:45:28 +0000 (18:45 +0100)
committerMike Brady <mikebrady@eircom.net>
Fri, 7 Apr 2017 17:45:28 +0000 (18:45 +0100)
common.c

index 0776407d0e4dd06638f7a16efb02c392bc57b0fe..0a60a1af4a5b4e9e7efedf91d4b3a452fa9ea78a 100644 (file)
--- a/common.c
+++ b/common.c
@@ -647,9 +647,10 @@ ssize_t non_blocking_write(int fd, const void *buf, size_t count) {
       // debug(1, "non-blocking write error waiting for pipe to become ready for writing...");
     } else if (rc == 0) {
       // warn("non-blocking write timeout waiting for pipe to become ready for writing");
-      rc = -2;
+      rc = -1;
+      errno = -ETIME;
     } else { // rc > 0, implying it might be ready
-      size_t bytes_written = write(fd, ibuf, bytes_remaining);
+      ssize_t bytes_written = write(fd, ibuf, bytes_remaining);
       if (bytes_written == -1) {
         // debug(1,"Error %d in non_blocking_write: \"%s\".",errno,strerror(errno));
         rc = -1;