From: Tim Waugh Date: Thu, 16 Oct 2014 13:53:17 +0000 (+0100) Subject: Don't use MIT-SHM on remote displays. X-Git-Tag: v1.3.90~21^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b17c9c4dedf09873b10b3c23d5f189aa9eba6978;p=tigervnc.git Don't use MIT-SHM on remote displays. When run from within 'ssh -X' or 'ssh -Y', MIT-SHM will appear to be available even though it won't work: the shared memory will be on the machine running vncviewer, not on the machine running the X server it displays to. Depending on what shm segments are available on the machine running the X server, the failure may not be apparent when checking that MIT-SHM works. Avoid this by not using MIT-SHM when XDisplayName() indicates we may not be running locally. Original bug report: https://bugzilla.redhat.com/show_bug.cgi?id=1072733 --- diff --git a/vncviewer/X11PixelBuffer.cxx b/vncviewer/X11PixelBuffer.cxx index 59b90e2c..f83aa5f4 100644 --- a/vncviewer/X11PixelBuffer.cxx +++ b/vncviewer/X11PixelBuffer.cxx @@ -156,6 +156,11 @@ int X11PixelBuffer::setupShm() Bool pixmaps; XErrorHandler old_handler; Status status; + const char *display_name = XDisplayName (NULL); + + /* Don't use MIT-SHM on remote displays */ + if (*display_name && *display_name != ':') + return 0; if (!XShmQueryVersion(fl_display, &major, &minor, &pixmaps)) return 0;