Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KJqaH-0005Gx-FR for qemu-devel@nongnu.org; Fri, 18 Jul 2008 10:05:21 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KJqaF-0005Fo-KL for qemu-devel@nongnu.org; Fri, 18 Jul 2008 10:05:20 -0400 Received: from [199.232.76.173] (port=47957 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJqaF-0005Fj-EP for qemu-devel@nongnu.org; Fri, 18 Jul 2008 10:05:19 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:43956) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KJqaE-0005Jp-Sx for qemu-devel@nongnu.org; Fri, 18 Jul 2008 10:05:19 -0400 Received: from mariner.uk.xensource.com ([10.80.2.22]) by smtp01.ad.xensource.com (8.13.1/8.13.1) with ESMTP id m6IE5Gjo025472 for ; Fri, 18 Jul 2008 07:05:17 -0700 Received: from iwj by mariner.uk.xensource.com with local (Exim 4.63) (envelope-from ) id 1KJqa3-00067I-Kw for qemu-devel@nongnu.org; Fri, 18 Jul 2008 15:05:07 +0100 From: Ian Jackson Date: Fri, 18 Jul 2008 14:28:52 +0100 Message-Id: Subject: [Qemu-devel] [PATCH 3/3] Do not disturb old fd flags (eg O_APPEND) when setting nonblock. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 files changed, 3 insertions(+), 1 deletions(-) diff --git a/vl.c b/vl.c index c428c7e..0fb9c17 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 */ -- 1.4.4.4