summaryrefslogtreecommitdiffstats
path: root/qga
diff options
context:
space:
mode:
authorGonglei2014-08-11 11:34:21 +0200
committerStefan Hajnoczi2014-08-15 19:03:13 +0200
commit16b38080e3383252f9606c484eb5b43cff70b673 (patch)
treefeab0e7e8d3822184799ab92ad669c6e38a161cd /qga
parentqemu-char: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK) (diff)
downloadqemu-16b38080e3383252f9606c484eb5b43cff70b673.tar.gz
qemu-16b38080e3383252f9606c484eb5b43cff70b673.tar.xz
qemu-16b38080e3383252f9606c484eb5b43cff70b673.zip
channel-posix: using qemu_set_nonblock() instead of fcntl(O_NONBLOCK)
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 <arei.gonglei@huawei.com> Signed-off-by: Wangxin <wangxinxin.wang@huawei.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'qga')
-rw-r--r--qga/channel-posix.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/qga/channel-posix.c b/qga/channel-posix.c
index e65dda3822..8aad4fee9f 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");