[X2Go-Commits] [nx-libs] 07/19: Loop.cpp: some reformatting/simplification/FIXMEs
git-admin at x2go.org
git-admin at x2go.org
Sat Dec 30 03:35:16 CET 2017
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch 3.6.x
in repository nx-libs.
commit 3066195d79f5f24f99483d29e2489a91c9251d73
Author: Ulrich Sibiller <uli42 at gmx.de>
Date: Wed Dec 27 13:09:25 2017 +0100
Loop.cpp: some reformatting/simplification/FIXMEs
(partially) fixes ArcticaProject/nx-libs#612
---
nxcomp/src/Loop.cpp | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/nxcomp/src/Loop.cpp b/nxcomp/src/Loop.cpp
index e84896e..e922b55 100644
--- a/nxcomp/src/Loop.cpp
+++ b/nxcomp/src/Loop.cpp
@@ -3861,7 +3861,8 @@ void SetupDisplaySocket(int &addr_family, sockaddr *&addr,
#ifdef __APPLE__
- if ((strncasecmp(display, "/tmp/launch", 11) == 0) || (strncasecmp(display, "/private/tmp/com.apple.launchd", 30) == 0))
+ if ((strncasecmp(display, "/tmp/launch", 11) == 0) ||
+ (strncasecmp(display, "/private/tmp/com.apple.launchd", 30) == 0))
{
nxinfo << "Loop: Using launchd service on socket '"
<< display << "'.\n" << std::flush;
@@ -3934,19 +3935,24 @@ void SetupDisplaySocket(int &addr_family, sockaddr *&addr,
// fall back to Unix domain socket file.
#ifdef __linux__
- int testSocketFD;
- testSocketFD = socket(addr_family, SOCK_STREAM, PF_UNSPEC);
+ int testSocketFD = socket(addr_family, SOCK_STREAM, PF_UNSPEC);
+ // this name cannot be changed as it is defined this way by the
+ // local X server
int len = sprintf(unixSocketName + 1, "/tmp/.X11-unix/X%d", xPort);
unixSocketName[0] = '\0';
sockaddr_un *xServerAddrABSTRACT = new sockaddr_un;
memset(xServerAddrABSTRACT, 0, sizeof(struct sockaddr_un));
xServerAddrABSTRACT -> sun_family = AF_UNIX;
+ // FIXME: ensure sun_path can hold len+1 bytes!
memcpy(xServerAddrABSTRACT -> sun_path, unixSocketName, len+1);
- addr_length = len +3;
+ // FIXME: comment why + 3?
+ addr_length = len + 3;
- int ret = connect(testSocketFD, (struct sockaddr *) xServerAddrABSTRACT, addr_length);
+ int ret = connect(testSocketFD,
+ (struct sockaddr *) xServerAddrABSTRACT,
+ addr_length);
close(testSocketFD);
if (ret == 0) {
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git
More information about the x2go-commits
mailing list