Received: from eggs.gnu.org ([2001:4830:134:3::10]:50362) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIKzL-0007C0-3A for qemu-devel@nongnu.org; Fri, 15 Aug 2014 13:08:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XIKzG-0000PG-4G for qemu-devel@nongnu.org; Fri, 15 Aug 2014 13:08:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27829) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XIKzF-0000Or-Sh for qemu-devel@nongnu.org; Fri, 15 Aug 2014 13:08:22 -0400 From: Stefan Hajnoczi Date: Fri, 15 Aug 2014 18:06:38 +0100 Message-Id: <1408122422-13935-32-git-send-email-stefanha@redhat.com> In-Reply-To: <1408122422-13935-1-git-send-email-stefanha@redhat.com> References: <1408122422-13935-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL 31/55] channel-posix: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Wangxin , Gonglei , Stefan Hajnoczi From: Gonglei Technically, fcntl(soc, F_SETFL, O_NONBLOCK) is incorrect since it clobbers all other file flags. We can use F_GETFL to get the current flags, set or clear the O_NONBLOCK flag, then use F_SETFL to set the flags. Using the qemu_set_nonblock() wrapper. Signed-off-by: Gonglei Signed-off-by: Wangxin Reviewed-by: Eric Blake Signed-off-by: Stefan Hajnoczi --- qga/channel-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qga/channel-posix.c b/qga/channel-posix.c index e65dda3..8aad4fe 100644 --- a/qga/channel-posix.c +++ b/qga/channel-posix.c @@ -42,7 +42,7 @@ static gboolean ga_channel_listen_accept(GIOChannel *channel, g_warning("error converting fd to gsocket: %s", strerror(errno)); goto out; } - fcntl(client_fd, F_SETFL, O_NONBLOCK); + qemu_set_nonblock(client_fd); ret = ga_channel_client_add(c, client_fd); if (ret) { g_warning("error setting up connection"); -- 1.9.3