Improve error reporting in non-blocking write code

This commit is contained in:
Mike Brady
2017-04-07 18:45:28 +01:00
parent 7860d69227
commit 5855264eff
+3 -2
View File
@@ -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;