libxcb/libxcb-1.1-abstract-socket.patch
2008-09-11 18:00:15 +00:00

27 lines
880 B
Diff

diff -up libxcb-1.1.91/src/xcb_util.c.abstract libxcb-1.1.91/src/xcb_util.c
--- libxcb-1.1.91/src/xcb_util.c.abstract 2008-07-13 07:42:41.000000000 -0400
+++ libxcb-1.1.91/src/xcb_util.c 2008-09-10 17:23:10.000000000 -0400
@@ -36,6 +36,7 @@
#endif
#include <netdb.h>
#include <errno.h>
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -251,6 +252,14 @@ static int _xcb_open_unix(char *protocol
if (protocol && strcmp("unix",protocol))
return -1;
+ memset(&addr, 0, sizeof(addr));
+ addr.sun_family = AF_UNIX;
+
+ /* try the abstract socket first */
+ strcpy(addr.sun_path + 1, file);
+ if(connect(fd, (struct sockaddr *) &addr, strlen(file) + 1 + offsetof(struct sockaddr_un, sun_path)) != -1)
+ return fd;
+
strcpy(addr.sun_path, file);
addr.sun_family = AF_UNIX;
#if HAVE_SOCKADDR_SUN_LEN