From 5364a1b45e79c605d5e5f02b2b57b5a7fe75636c Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Mon, 18 May 2020 20:10:50 +0200 Subject: socket: Make sure fd is ready to write before calling send() --- common/socket.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/socket.c b/common/socket.c index cf6e9eb..a47de2a 100644 --- a/common/socket.c +++ b/common/socket.c @@ -690,6 +690,10 @@ int socket_receive_timeout(int fd, void *data, size_t length, int flags, int socket_send(int fd, void *data, size_t length) { int flags = 0; + int res = socket_check_fd(fd, FDM_WRITE, 1000); + if (res <= 0) { + return res; + } #ifdef MSG_NOSIGNAL flags |= MSG_NOSIGNAL; #endif -- cgit v1.1-32-gdbae