summaryrefslogtreecommitdiff
path: root/util/qemu-sockets.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2013-03-27 10:10:45 +0100
committerLuiz Capitulino <lcapitulino@redhat.com>2013-04-02 11:47:37 -0400
commit1a751ebfbb2d7a696b889d8208cb5ffc83c090b1 (patch)
treee277914b66d699190851f7c3284b58629ea6373d /util/qemu-sockets.c
parentfc13fa00eaff6797c67abc9b0f748b346f238986 (diff)
downloadqemu-1a751ebfbb2d7a696b889d8208cb5ffc83c090b1.tar.gz
qemu-socket: set passed fd non-blocking in socket_connect()
socket_connect() sets non-blocking on TCP or UNIX domain sockets if a callback function is passed. Do the same for file descriptor passing, otherwise we could unexpectedly be using a blocking file descriptor. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'util/qemu-sockets.c')
-rw-r--r--util/qemu-sockets.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index b632a740ab..94581aa236 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -910,6 +910,7 @@ int socket_connect(SocketAddress *addr, Error **errp,
case SOCKET_ADDRESS_KIND_FD:
fd = monitor_get_fd(cur_mon, addr->fd->str, errp);
if (callback) {
+ qemu_set_nonblock(fd);
callback(fd, opaque);
}
break;