Blob Blame History Raw
diff -up libxcb-1.0/src/xcb_util.c.jx libxcb-1.0/src/xcb_util.c
--- libxcb-1.0/src/xcb_util.c.jx	2006-11-21 23:20:15.000000000 -0500
+++ libxcb-1.0/src/xcb_util.c	2007-08-24 14:02:08.000000000 -0400
@@ -213,14 +213,23 @@ static int _xcb_open_tcp(char *host, con
 static int _xcb_open_unix(const char *file)
 {
     int fd;
-    struct sockaddr_un addr = { AF_UNIX };
-    strcpy(addr.sun_path, file);
+    struct sockaddr_un addr;
+    memset(&addr, 0, sizeof(addr));
+    addr.sun_family = AF_UNIX;
 
     fd = socket(AF_UNIX, SOCK_STREAM, 0);
     if(fd == -1)
         return -1;
+
+    /* try the abstract socket first */
+    strcpy(addr.sun_path + 1, file);
+    if(connect(fd, (struct sockaddr *) &addr, sizeof(addr)) != -1)
+        return fd;
+
+    strcpy(addr.sun_path, file);
     if(connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1)
         return -1;
+
     return fd;
 }