diff mbox

[1/3] vnc: Don't assert if opening unix socket fails

Message ID 4321b926ed926ba64dc32f74c5f3b4ae9627f7ef.1430325445.git.crobinso@redhat.com
State New
Headers show

Commit Message

Cole Robinson April 29, 2015, 4:37 p.m. UTC
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 <crobinso@redhat.com>
---
 ui/vnc.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Gerd Hoffmann May 5, 2015, 9:48 a.m. UTC | #1
On Mi, 2015-04-29 at 12:37 -0400, Cole Robinson wrote:
> +            if (vs->lsock < 0)
> +                goto fail;

fails checkpatch.pl
diff mbox

Patch

diff --git a/ui/vnc.c b/ui/vnc.c
index cffb5b7..f6b36e4 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3685,6 +3685,8 @@  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);