From: Ian Jackson Date: Fri, 18 Jul 2008 13:28:52 +0000 (+0100) Subject: Do not disturb old fd flags (eg O_APPEND) when setting nonblock. X-Git-Tag: xen-3.3.0-rc1~20^2~1 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=454f34b59e80edd4938686ea3c89a07a86694727;p=qemu-xen-4.0-testing.git 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 --- 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 */