aboutsummaryrefslogtreecommitdiff
path: root/debian/patches/027_nxcomp_abstract-X11-socket.full+lite.patch
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2014-06-11 12:25:52 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2014-06-11 12:33:03 +0200
commit065dcc90303798f380755551dbc5deb13df23ec5 (patch)
treeb7c1135286c7812738ac853900660a9684520a95 /debian/patches/027_nxcomp_abstract-X11-socket.full+lite.patch
parent5a07d00e0476ad278d1e54e51b667e1b5b95fd2e (diff)
downloadnx-libs-065dcc90303798f380755551dbc5deb13df23ec5.tar.gz
nx-libs-065dcc90303798f380755551dbc5deb13df23ec5.tar.bz2
nx-libs-065dcc90303798f380755551dbc5deb13df23ec5.zip
fix patch name
Diffstat (limited to 'debian/patches/027_nxcomp_abstract-X11-socket.full+lite.patch')
-rw-r--r--debian/patches/027_nxcomp_abstract-X11-socket.full+lite.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/debian/patches/027_nxcomp_abstract-X11-socket.full+lite.patch b/debian/patches/027_nxcomp_abstract-X11-socket.full+lite.patch
new file mode 100644
index 000000000..4f614338c
--- /dev/null
+++ b/debian/patches/027_nxcomp_abstract-X11-socket.full+lite.patch
@@ -0,0 +1,56 @@
+diff --git a/nxcomp/Loop.cpp b/nxcomp/Loop.cpp
+index 92b6fc2..d86809d 100644
+--- a/nxcomp/Loop.cpp
++++ b/nxcomp/Loop.cpp
+@@ -4250,6 +4250,39 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
+ // where the socket will be created.
+ //
+
++ // Try abstract X11 socket first (via a test connect), if that fails
++ // fall back to Unix domain socket file.
++
++ #ifdef __linux__
++ int testSocketFD;
++ testSocketFD = socket(xServerAddrFamily, SOCK_STREAM, PF_UNSPEC);
++
++ int len = sprintf(unixSocketName + 1, "/tmp/.X11-unix/X%d", xPort);
++ unixSocketName[0] = '\0';
++
++ sockaddr_un *xServerAddrABSTRACT = new sockaddr_un;
++ memset(xServerAddrABSTRACT, 0, xServerAddrLength);
++ xServerAddrABSTRACT -> sun_family = AF_UNIX;
++ memcpy(xServerAddrABSTRACT -> sun_path, unixSocketName, len+1);
++ xServerAddrLength = len +3;
++
++ int ret = connect(testSocketFD, (struct sockaddr *) xServerAddrABSTRACT, xServerAddrLength);
++ if (ret == 0) {
++
++ cerr << "Info" << ": Using abstract X11 socket in kernel namespace "
++ << "for accessing DISPLAY=:" << xPort << ".\n";
++
++ close(testSocketFD);
++ xServerAddr = (sockaddr *) xServerAddrABSTRACT;
++ return 1;
++
++ } else {
++
++ cerr << "Info" << ": Falling back to file system X11 socket "
++ << "for accessing DISPLAY=:" << xPort << ".\n";
++
++ #endif
++
+ struct stat statInfo;
+
+ char unixSocketDir[DEFAULT_STRING_LENGTH];
+@@ -4322,6 +4355,11 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
+
+ xServerAddr = (sockaddr *) xServerAddrUNIX;
+ xServerAddrLength = sizeof(sockaddr_un);
++
++ #ifdef __linux__
++
++ }
++ #endif
+ }
+ else
+ {