[stable-1.4,3/4] qemu-socket: set passed fd non-blocking in socket_connect()

Message ID 1365075615-14027-4-git-send-email-stefanha@redhat.com
State New
Headers show

Commit Message

Stefan Hajnoczi April 4, 2013, 11:40 a.m.
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>
 util/qemu-sockets.c | 1 +
 1 file changed, 1 insertion(+)


diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index e92e0d5..cd54fb4 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -906,6 +906,7 @@  int socket_connect(SocketAddress *addr, Error **errp,
         fd = monitor_get_fd(cur_mon, addr->fd->str, errp);
         if (callback) {
+            qemu_set_nonblock(fd);
             callback(fd, opaque);