qemu-socket: catch monitor_get_fd failures
authorGerd Hoffmann <kraxel@redhat.com>
Mon, 24 Jun 2013 06:39:46 +0000 (08:39 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Fri, 28 Jun 2013 18:10:33 +0000 (22:10 +0400)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
util/qemu-sockets.c

index 35023a8a92d4c94dd8a81e037073c4b36d84b9df..126cbb603be443f9bc6f971ebcdead266180f292 100644 (file)
@@ -903,7 +903,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) {
+        if (fd >= 0 && callback) {
             qemu_set_nonblock(fd);
             callback(fd, opaque);
         }