Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
proton-0.12.0
-
linux/posix
Description
posix/io.cpp:
size_t socket_engine::io_write(const char *buf, size_t size) {
ssize_t n = ::write(socket_, buf, size);
if (n == EAGAIN || n == EWOULDBLOCK) return 0;
if (n < 0) check(n, "write: ");
return n;
}
instead of testing n against EAGAIN/EWOULDBLOCK, n needs to be tested against -1 and then errno needs to be compared to EAGAIN/EWOULDBLOCK
proposed fix:
size_t socket_engine::io_write(const char *buf, size_t size) {
ssize_t n = ::write(socket_, buf, size);
if (n < 0) {
if (errno == EAGAIN || errno == EWOULDBLOCK)
check(n, "write: ");
}
return n;
}