diff --git a/src/fds.cpp b/src/fds.cpp index 385196b8c..daa74866a 100644 --- a/src/fds.cpp +++ b/src/fds.cpp @@ -175,7 +175,7 @@ bool fd_event_signaller_t::try_consume() const { do { ret = read(read_fd(), buff, sizeof buff); } while (ret < 0 && errno == EINTR); - if (ret < 0 && errno != EAGAIN) { + if (ret < 0 && errno != EAGAIN && errno != EWOULDBLOCK) { wperror(L"read"); } return ret > 0; @@ -193,7 +193,7 @@ void fd_event_signaller_t::post() { ret = write(write_fd(), &c, sizeof c); } while (ret < 0 && errno == EINTR); // EAGAIN occurs if either the pipe buffer is full or the eventfd overflows (very unlikely). - if (ret < 0 && errno != EAGAIN) { + if (ret < 0 && errno != EAGAIN && errno != EWOULDBLOCK) { wperror(L"write"); } } diff --git a/src/io.cpp b/src/io.cpp index cf603ac9a..1dbfc68e9 100644 --- a/src/io.cpp +++ b/src/io.cpp @@ -68,7 +68,7 @@ ssize_t io_buffer_t::read_once(int fd, acquired_lock &buffer do { amt = read(fd, bytes, sizeof bytes); } while (amt < 0 && errno == EINTR); - if (amt < 0 && errno != EAGAIN) { + if (amt < 0 && errno != EAGAIN && errno != EWOULDBLOCK) { wperror(L"read"); } else if (amt > 0) { buffer->append(bytes, static_cast(amt)); @@ -116,7 +116,7 @@ void io_buffer_t::begin_filling(autoclose_fd_t fd) { // select() reported us as readable; read a bit. auto buffer = buffer_.acquire(); ssize_t ret = read_once(fd.fd(), buffer); - done = (ret == 0 || (ret < 0 && errno != EAGAIN)); + done = (ret == 0 || (ret < 0 && errno != EAGAIN && errno != EWOULDBLOCK)); } else if (shutdown_fillthread_) { // Here our caller asked us to shut down; read while we keep getting data. // This will stop when the fd is closed or if we get EAGAIN. diff --git a/src/topic_monitor.cpp b/src/topic_monitor.cpp index a2562189f..41ef6885e 100644 --- a/src/topic_monitor.cpp +++ b/src/topic_monitor.cpp @@ -96,7 +96,7 @@ void binary_semaphore_t::wait() { auto amt = read(fd, &ignored, sizeof ignored); if (amt == 1) break; // EAGAIN should only be returned in TSan case. - if (amt < 0 && errno != EINTR && errno != EAGAIN) die(L"read"); + if (amt < 0 && errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK) die(L"read"); } } }