[Xcb-commit] 2 commits - src

Alan Coopersmith alanc at kemper.freedesktop.org
Tue Apr 12 13:02:47 PDT 2011


 src/xcb_util.c |   24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

New commits:
commit b64cd0df884e7901ff13def0272df74962035920
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Apr 4 21:36:47 2011 -0700

    If protocol is "unix", use a Unix domain socket, not TCP
    
    Fixes fallback to local connections from Xlib's XOpenDisplay(), which
    will try with protocol "unix" if a hostname is specified and tcp fails
    (as it usually will now that most OS'es ship with -nolisten tcp enabled).
    
    Also fixes explicitly specifying DISPLAY as "unix/foo:0", which Xlib
    previously accepted for Unix domain sockets.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/src/xcb_util.c b/src/xcb_util.c
index 818746b..fde4f85 100644
--- a/src/xcb_util.c
+++ b/src/xcb_util.c
@@ -178,15 +178,13 @@ static int _xcb_open(const char *host, char *protocol, const int display)
     }
 #endif
 
-    if(*host || protocol)
+    /* If protocol or host is "unix", fall through to Unix socket code below */
+    if ((!protocol || (strcmp("unix",protocol) != 0)) &&
+        (*host != '\0') && (strcmp("unix",host) != 0))
     {
-        if (protocol
-            || strcmp("unix",host)) { /* follow the old unix: rule */
-
-            /* display specifies TCP */
-            unsigned short port = X_TCP_PORT + display;
-            return _xcb_open_tcp(host, protocol, port);
-        }
+        /* display specifies TCP */
+        unsigned short port = X_TCP_PORT + display;
+        return _xcb_open_tcp(host, protocol, port);
     }
 
 #ifndef _WIN32
commit b027922ebf1931885e00629c20e26f14f184998d
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Apr 4 21:28:00 2011 -0700

    Make launchd code in xcb_util.c match surrounding code indent levels
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>

diff --git a/src/xcb_util.c b/src/xcb_util.c
index ad9b3df..818746b 100644
--- a/src/xcb_util.c
+++ b/src/xcb_util.c
@@ -171,11 +171,11 @@ static int _xcb_open(const char *host, char *protocol, const int display)
     int actual_filelen;
 
 #ifdef HAVE_LAUNCHD
-        if(strncmp(host, "/tmp/launch", 11) == 0) {
-		base = host;
-		host = "";
-		protocol = NULL;
-        }
+    if(strncmp(host, "/tmp/launch", 11) == 0) {
+        base = host;
+        host = "";
+        protocol = NULL;
+    }
 #endif
 
     if(*host || protocol)


More information about the xcb-commit mailing list