Patchwork [v2,03/13] qemu-socket: catch monitor_get_fd failures

login
register
mail settings
Submitter Gerd Hoffmann
Date June 24, 2013, 6:39 a.m.
Message ID <1372055996-4072-4-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/253638/
State New
Headers show

Comments

Gerd Hoffmann - June 24, 2013, 6:39 a.m.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 util/qemu-sockets.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index 35023a8..126cbb6 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -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);
         }