- libxcb-1.0-abstract-socket.patch: When connecting to the X server, prefer

abstract-namespace unix sockets to filesystem-bound sockets.
This commit is contained in:
Adam Jackson 2007-08-24 21:44:02 +00:00
parent ee43f98d64
commit b6f56cd794
2 changed files with 37 additions and 2 deletions

View File

@ -0,0 +1,29 @@
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;
}

View File

@ -1,6 +1,6 @@
Name: libxcb
Version: 1.0
Release: 2%{?dist}
Release: 3%{?dist}
Summary: A C binding to the X11 protocol
Group: System Environment/Libraries
@ -10,6 +10,7 @@ Source0: http://xcb.freedesktop.org/dist/%{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Patch0: libxcb-1.0-no-pthread-stubs.patch
Patch1: libxcb-1.0-abstract-socket.patch
BuildRequires: autoconf automake libtool pkgconfig
BuildRequires: doxygen
@ -44,7 +45,8 @@ The %{name}-doc package contains documentation for the %{name} library.
%prep
%setup -q
%patch -p1 -b .pthread-stubs
%patch0 -p1 -b .pthread-stubs
%patch1 -p1 -b .abstract
%build
autoreconf -v --install
@ -78,6 +80,10 @@ rm -rf $RPM_BUILD_ROOT
%{_datadir}/doc/%{name}-%{version}
%changelog
* Fri Aug 24 2007 Adam Jackson <ajax@redhat.com> 1.0-3
- libxcb-1.0-abstract-socket.patch: When connecting to the X server, prefer
abstract-namespace unix sockets to filesystem-bound sockets.
* Wed Aug 22 2007 Adam Jackson <ajax@redhat.com> - 1.0-2
- Rebuild for PPC toolchain bug