mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-02 10:42:27 +00:00
Fix bug with send() on Windows in O_NONBLOCK mode
There is a bug in WIN32 where using CancelIoEx() on an overlapped i/o op initiated by WSASend() will cause WSAGetOverlappedResult() to report the operation failed when it actually succeeded. We now work around that, by having send and sendto initially consult WSAPoll() on O_NONBLOCK sockets
This commit is contained in:
parent
5aa970bc4e
commit
3c58ecd00c
4 changed files with 22 additions and 5 deletions
|
@ -56,7 +56,7 @@ textwindows ssize_t sys_send_nt(int fd, const struct iovec *iov, size_t iovlen,
|
|||
sigset_t m = __sig_block();
|
||||
bool nonblock = (f->flags & O_NONBLOCK) || (flags & _MSG_DONTWAIT);
|
||||
flags &= ~_MSG_DONTWAIT;
|
||||
rc = __winsock_block(f->handle, flags, nonblock, f->sndtimeo, m,
|
||||
rc = __winsock_block(f->handle, flags, -nonblock, f->sndtimeo, m,
|
||||
sys_send_nt_start, &(struct SendArgs){iov, iovlen});
|
||||
__sig_unblock(m);
|
||||
return rc;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue