From e3ee57a95b246f6dbc5fb62723db86346967a516 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 14 Sep 2015 14:35:05 +0200 Subject: [PATCH] Refuse to start Xvnc if we failed to initialise a screen Starting Xvnc without having any VNC functionality is pretty much pointless. So terminate when that happens, making the situation easier to detect for startup scripts. --- unix/xserver/hw/vnc/vncExtInit.cc | 5 +++++ unix/xserver/hw/vnc/vncExtInit.h | 1 + unix/xserver/hw/vnc/xvnc.c | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/unix/xserver/hw/vnc/vncExtInit.cc b/unix/xserver/hw/vnc/vncExtInit.cc index e307e319..d9f989a9 100644 --- a/unix/xserver/hw/vnc/vncExtInit.cc +++ b/unix/xserver/hw/vnc/vncExtInit.cc @@ -205,6 +205,11 @@ void vncExtensionInit(void) vncRegisterBlockHandlers(); } +int vncExtensionIsActive(int scrIdx) +{ + return (desktop[scrIdx] != NULL); +} + void vncCallReadBlockHandlers(fd_set * fds, struct timeval ** timeout) { for (int scr = 0; scr < vncGetScreenCount(); scr++) diff --git a/unix/xserver/hw/vnc/vncExtInit.h b/unix/xserver/hw/vnc/vncExtInit.h index 65cbbe40..6430ac05 100644 --- a/unix/xserver/hw/vnc/vncExtInit.h +++ b/unix/xserver/hw/vnc/vncExtInit.h @@ -50,6 +50,7 @@ extern int vncFbstride[]; extern int vncInetdSock; void vncExtensionInit(void); +int vncExtensionIsActive(int scrIdx); void vncCallReadBlockHandlers(fd_set * fds, struct timeval ** timeout); void vncCallReadWakeupHandlers(fd_set * fds, int nfds); diff --git a/unix/xserver/hw/vnc/xvnc.c b/unix/xserver/hw/vnc/xvnc.c index cac2aeeb..ee3dab25 100644 --- a/unix/xserver/hw/vnc/xvnc.c +++ b/unix/xserver/hw/vnc/xvnc.c @@ -1744,6 +1744,11 @@ void ProcessInputEvents(void) void InitInput(int argc, char *argv[]) { + int i; + for (i = 0;i < screenInfo.numScreens;i++) { + if (!vncExtensionIsActive(i)) + FatalError("failed to activate VNC extension for one or more screens"); + } mieqInit (); } -- 2.39.5