]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
qemu-socket: set passed fd non-blocking in socket_connect()
authorStefan Hajnoczi <stefanha@redhat.com>
Thu, 4 Apr 2013 14:18:30 +0000 (16:18 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Thu, 4 Apr 2013 20:17:32 +0000 (15:17 -0500)
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>
(cherry picked from commit 35fb94fa292173a3e1df0768433e06912a2a88e4)

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
util/qemu-sockets.c

index e92e0d568aa66829e28a95874c1f8461b110aceb..cd54fb4af7766fb74753b48e2eba3f6c4c6eda0e 100644 (file)
@@ -906,6 +906,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;