From: Cole Robinson Date: Tue, 5 May 2015 15:07:17 +0000 (-0400) Subject: vnc: Don't assert if opening unix socket fails X-Git-Tag: v2.4.0-rc0~127^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3d00ac1a2ee0294fc3d460e6013a5cdd9c73ea6c;p=thirdparty%2Fqemu.git vnc: Don't assert if opening unix socket fails Reproducer: $ qemu-system-x86_64 -display vnc=unix:/root/i-cant-access-you.sock qemu-system-x86_64: iohandler.c:60: qemu_set_fd_handler2: Assertion `fd >= 0' failed. Aborted (core dumped) Signed-off-by: Cole Robinson Reviewed-by: Eric Blake Signed-off-by: Gerd Hoffmann --- diff --git a/ui/vnc.c b/ui/vnc.c index 076355d9c5e..fe4cd759a1e 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -3684,6 +3684,9 @@ void vnc_display_open(const char *id, Error **errp) /* listen for connects */ if (strncmp(vnc, "unix:", 5) == 0) { vs->lsock = unix_listen(vnc+5, NULL, 0, errp); + if (vs->lsock < 0) { + goto fail; + } vs->is_unix = true; } else { vs->lsock = inet_listen_opts(sopts, 5900, errp);