From 454f34b59e80edd4938686ea3c89a07a86694727 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 18 Jul 2008 14:28:52 +0100 Subject: [PATCH] Do not disturb old fd flags (eg O_APPEND) when setting nonblock. socket_set_nonblock should not unconditionally call fcntl(,F_SETFL,O_NONBLOCK) because that would clear other flags which might be intentionally set on the fd. Signed-off-by: Ian Jackson --- vl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vl.c b/vl.c index c428c7e8..0fb9c176 100644 --- a/vl.c +++ b/vl.c @@ -2005,7 +2005,9 @@ static inline int send_all(int fd, const uint8_t *buf, int len1) void socket_set_nonblock(int fd) { - fcntl(fd, F_SETFL, O_NONBLOCK); + int f; + f = fcntl(fd, F_GETFL); + fcntl(fd, F_SETFL, f | O_NONBLOCK); } #endif /* !_WIN32 */ -- 2.39.5