]> xenbits.xensource.com Git - qemu-upstream-4.4-testing.git/commitdiff
qemu-socket: set passed fd non-blocking in socket_connect()
authorStefan Hajnoczi <stefanha@redhat.com>
Wed, 27 Mar 2013 09:10:45 +0000 (10:10 +0100)
committerLuiz Capitulino <lcapitulino@redhat.com>
Tue, 2 Apr 2013 15:47:37 +0000 (11:47 -0400)
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>
util/qemu-sockets.c

index b632a740abf3278f7209647bff985d913f75e6e3..94581aa236c4f5046d83f136460a29f8d1f5d102 100644 (file)
@@ -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;