diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2008-05-24 15:44:22 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2008-05-24 15:44:22 +0000 |
commit | 8d1f1e51a94b497e7d18f4eab311962119d29f2b (patch) | |
tree | 7d3f3e2072bbe8cc8a2648883615d9a8c74c821f /lib | |
parent | d9c081456b4e271f93cfc07c3a66663f188edf7a (diff) |
Update to libxtrans 1.2
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libxtrans/ChangeLog | 208 | ||||
-rw-r--r-- | lib/libxtrans/Xtrans.c | 91 | ||||
-rw-r--r-- | lib/libxtrans/Xtrans.h | 6 | ||||
-rw-r--r-- | lib/libxtrans/Xtransdnet.c | 6 | ||||
-rw-r--r-- | lib/libxtrans/Xtransint.h | 16 | ||||
-rw-r--r-- | lib/libxtrans/Xtranslcl.c | 8 | ||||
-rw-r--r-- | lib/libxtrans/Xtranssock.c | 253 | ||||
-rw-r--r-- | lib/libxtrans/Xtranstli.c | 6 | ||||
-rw-r--r-- | lib/libxtrans/Xtransutil.c | 14 | ||||
-rw-r--r-- | lib/libxtrans/aclocal.m4 | 4 | ||||
-rw-r--r-- | lib/libxtrans/configure | 24 | ||||
-rw-r--r-- | lib/libxtrans/configure.ac | 5 | ||||
-rw-r--r-- | lib/libxtrans/transport.c | 6 | ||||
-rw-r--r-- | lib/libxtrans/xtrans.m4 | 18 |
14 files changed, 518 insertions, 147 deletions
diff --git a/lib/libxtrans/ChangeLog b/lib/libxtrans/ChangeLog index 1e1837aa6..85d971de8 100644 --- a/lib/libxtrans/ChangeLog +++ b/lib/libxtrans/ChangeLog @@ -1,3 +1,211 @@ +commit e75b9dad0ae4bc0869af81652d8259675a3c5cac +Author: Julien Cristau <jcristau@debian.org> +Date: Thu May 8 16:27:29 2008 +0200 + + Bump to 1.2 + +commit 962ad4d3f8096f5ffa14b32b3ee094f250790c77 +Author: Alan Hourihane <alanh@tungstengraphics.com> +Date: Mon Apr 28 23:46:05 2008 +0100 + + disable UNIXCONN on MINGW + +commit 9e8c0e3356bc6359368b7655d3a717d6c000387e +Author: Alan Hourihane <alanh@tungstengraphics.com> +Date: Sat Apr 26 16:23:19 2008 +0100 + + fix build for MAKEWORD + +commit 568c5ea02ee1de437833ee0b53a7b3fd7ece084f +Author: Colin Harrison <colin.harrison-at-virgin.net> +Date: Sat Apr 26 08:53:13 2008 +0100 + + Update to winsock2 + +commit 960902584a3ef125946beb5ebe331b54d697e9d9 +Author: James Cloos <cloos@jhcloos.com> +Date: Fri Apr 25 15:53:20 2008 -0400 + + Fix length calculation for the path for abstract unix domain sockets + + Since the struct has a fixed-lenght char[] its sizeof() contains + trailing NUL octets which results in corrupt abstract sockets. + + Instead, take the strlen(3) of the path, plus the single NUL octet + (which identifies the path as an abstract path rather than a file- + system path) plus the offset from the start of the struct to the + start of the char array. + + This fixes: + + https://bugs.freedesktop.org/show_bug.cgi?id=15677 + +commit 3a2a5375b8aab85697b4f2644ab99c3ccf79e658 +Author: Colin Harrison <colin.harrison-at-virgin.net> +Date: Wed Apr 23 10:39:30 2008 +0100 + + Only call WSAGetLastError() if there has been an + error condition. + +commit ac13a1a34b61247a21da130f0ba9922f35d3dc3b +Author: Alan Coopersmith <alan.coopersmith@sun.com> +Date: Tue Apr 15 12:32:35 2008 -0700 + + Sun bug #6688467: _X11TransConvertAddress: Unknown family type on 64-bit SPARC + + Check for socklen_t definition and if found use it instead of size_t or + int for the length argument to getpeername/getsockname/etc. + + <http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6688467> + +commit 556a351de83fc6f401b02213dae95731553c216d +Author: Loïc Minier <lool@dooz.org> +Date: Mon Mar 24 15:38:27 2008 -0400 + + Bug #10489: Don't retry unix socket connect()s on ENOENT. + + If the socket isn't there, it's not gonna magically appear. Either it's + a server socket and you should have just waited for the SIGUSR1 from the + server, or it's a stale reference to an ICE socket. + + However, do retry once, so fallback from abstract to filesystem namespace + works. + + Originally Debian bug #385976. + +commit 3de3e666e0653d4e8ae23fc3e6e31864ddad4059 +Author: Julien Cristau <jcristau@debian.org> +Date: Sun Mar 23 19:43:32 2008 +0100 + + BSD44SOCKETS is the wrong check for SOCK_MAXADDRLEN + + GNU/kFreeBSD defines BSD44SOCKETS, but doesn't have SOCK_MAXADDRLEN. + Check for the latter directly. + +commit 662994b9096181117cec4cae88f24bf6da806159 +Author: Adam Jackson <ajax@redhat.com> +Date: Wed Mar 5 21:02:28 2008 -0500 + + xtrans 1.1 + +commit 2afe206ec9569e0d62caa6d91c3fb057b0efa23d +Author: Adam Jackson <ajax@redhat.com> +Date: Wed Mar 5 20:48:59 2008 -0500 + + Add support for the abstract socket namespace under Linux. + + Unlike normal unix sockets, the abstract namespace is not bound to the + filesystem. This has some notable advantages; /tmp need not exist, the + socket directory need not have magic permissions, etc. xtrans servers + will listen on both the normal and abstract socket endpoints; clients + will attempt to connect to the abstract socket before connecting to the + corresponding filesystem socket. + + Based on a patch by Bill Crawford. + +commit c8ed67f16f71042ef134a4d2189c20dd200a0648 +Author: Jeremy Huddleston <jeremy@tifa.local> +Date: Sun Feb 10 19:04:40 2008 -0800 + + Fixed #ifdef checks that were using i386 to use __i386__ + + """ + + It's simply obsolete, sloppy, compiler namespace pollution. The + compiler is not allowed to predefine symbols that might conflict with + ordinary identifiers. For backwards compatibility gcc currently + predefines i386 when compiling for x86 32-bit (but not 64-bit), but that + will go away. It is also not defined if you specify -ansi when invoking + the compiler, because then it is seriously standards compliant. Other + compilers shouldn't define it either. Correct code shouldn't rely on it + being defined. However __i386__ is safe and proper. + + """ + +commit 9970b5b6f8237685267b7972282319cf266661ea +Author: Ben Byer <bbyer@bbyer.local> +Date: Sun Dec 2 07:36:51 2007 -0800 + + make launchd error messages less scary + +commit cd1da5cec49fb7fe6238a00d9ba550b3ed78fa08 +Author: Ben Byer <bbyer@bbyer.local> +Date: Wed Nov 14 03:57:57 2007 -0800 + + Fix for incorrect processing of recycled launchd socket on OS X + +commit 3da4d6c1dc05f9e1291b023a97535eb67f0830e2 +Author: Ben Byer <bbyer@bbyer.local> +Date: Wed Nov 14 03:55:42 2007 -0800 + + removed cvs tags + +commit 496cf2c46d2123c3bed3e6878f8f9a62e87ce559 +Author: Dodji Seketeli <dodji@seketeli.org> +Date: Tue Sep 11 12:52:44 2007 +0200 + + libxtrans: fixed a typo in my last commit + + * Xtranssock.c: (SocketReopen): oops fix a typo in my last commit. + +commit 88e141225113fcc4ebe5e8fe361e75673cdbf9ff +Author: Dodji Seketeli <dodji@seketeli.org> +Date: Tue Sep 11 08:48:03 2007 +0200 + + libxtrans: fix linux compilation breakage + + * Xtranssock.c: + (SocketReopen): protect use of BSD4.4 socket with BSD44SOCKETS macro. + protect use of strlcnpy with HAVE_STRLCPY macro. + That one is defined (or not) by the xserver configure. + +commit 6217f34977bfa17b66b89df5d45420774abedcb3 +Author: Ben Byer <bbyer@bbyer.apple.com> +Date: Wed Sep 5 18:29:44 2007 -0700 + + changes to support launchd on OS X + +commit 4d0cfe491046df26027db291530b247b7f24df5b +Author: Ben Byer <bbyer@bbyer.apple.com> +Date: Wed Sep 5 18:04:01 2007 -0700 + + suppress warning about socket directory ownership on OS X + + We don't need to warn the user about the fact that the socket + directory is not owned by root under OS X; on that platform, + it's never owned by root, as the X server runs as the normal user. + +commit de93d67f6d48c7c08f2554cb85515bcf7dfbffb2 +Author: Alan Coopersmith <alan.coopersmith@sun.com> +Date: Tue Aug 21 17:54:23 2007 -0700 + + Version bump: 1.0.4 + +commit 5e16b0ebccb233f7aeaf3928a853ee966b7cbb39 +Author: Kean Johnston <kean@armory.com> +Date: Wed Jul 18 09:27:06 2007 -0700 + + Fix typo in Xtranslcl.c (sprintf with size argument should be snprintf) + +commit 1abc981349140260d6fb643d29cf2b851fc06ac9 +Author: Daniel Stone <daniel@fooishbar.org> +Date: Sat Dec 16 01:15:21 2006 +0200 + + bump to 1.0.3 + +commit 8172528bb894856aa5b133f61444294dc5a347e6 +Author: Daniel Stone <daniel@fooishbar.org> +Date: Wed Dec 6 18:51:59 2006 +0200 + + Makefile.am: make ChangeLog hook safer + Make ChangeLog hook as safe as possible. + +commit 5ffb704b1df9ec44a448d53d4c20b9d4c5d825d4 +Author: Adam Jackson <ajax@benzedrine.nwnk.net> +Date: Fri Oct 13 17:01:59 2006 -0400 + + Bump to 1.0.2 + commit ae3b57953f5c1fa875d19fb42a2178d7e594ea44 Author: Adam Jackson <ajax@benzedrine.nwnk.net> Date: Thu Oct 12 20:36:52 2006 -0400 diff --git a/lib/libxtrans/Xtrans.c b/lib/libxtrans/Xtrans.c index f92fc7b77..fde3cb073 100644 --- a/lib/libxtrans/Xtrans.c +++ b/lib/libxtrans/Xtrans.c @@ -1,5 +1,3 @@ -/* $XdotOrg: xc/lib/xtrans/Xtrans.c,v 1.4 2004/11/15 15:06:56 ago Exp $ */ -/* $Xorg: Xtrans.c,v 1.4 2001/02/09 02:04:06 xorgcvs Exp $ */ /* Copyright 1993, 1994, 1998 The Open Group @@ -26,10 +24,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. -*/ -/* $XFree86: xc/lib/xtrans/Xtrans.c,v 3.33 2003/08/11 17:41:29 eich Exp $ */ - -/* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA + * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA * * All Rights Reserved * @@ -53,6 +48,9 @@ from The Open Group. */ #include <ctype.h> +#ifdef HAVE_LAUNCHD +#include <launch.h> +#endif /* * The transport table contains a definition for every transport (protocol) @@ -362,6 +360,15 @@ TRANS(ParseAddress) (char *address, char **protocol, char **host, char **port) */ #endif +#ifdef HAVE_LAUNCHD + /* launchd sockets will look like 'local//tmp/launch-XgkNns/:0' */ + if(address != NULL && strlen(address)>8 && (!strncmp(address,"local//",7))) { + _protocol="local"; + _host=""; + _port=address+6; + } +#endif + /* * Now that we have all of the components, allocate new * string space for them. @@ -866,6 +873,10 @@ TRANS(Connect) (XtransConnInfo ciptr, char *address) return -1; } +#ifdef HAVE_LAUNCHD + if (!host || !*host) host=strdup(""); +#endif + if (!port || !*port) { PRMSG (1,"Connect: Missing port specification in %s\n", @@ -1061,15 +1072,73 @@ TRANS(MakeAllCOTSServerListeners) (char *port, int *partial, int *count_ret, char buffer[256]; /* ??? What size ?? */ XtransConnInfo ciptr, temp_ciptrs[NUMTRANS]; int status, i, j; +#ifdef HAVE_LAUNCHD + int launchd_fd; + launch_data_t sockets_dict, checkin_request, checkin_response; + launch_data_t listening_fd_array, listening_fd; +#endif + #if defined(IPv6) && defined(AF_INET6) int ipv6_succ = 0; #endif - PRMSG (2,"MakeAllCOTSServerListeners(%s,%p)\n", port ? port : "NULL", ciptrs_ret, 0); *count_ret = 0; +#ifdef HAVE_LAUNCHD + /* Get launchd fd */ + if ((checkin_request = launch_data_new_string(LAUNCH_KEY_CHECKIN)) == NULL) { + fprintf(stderr,"launch_data_new_string(\"" LAUNCH_KEY_CHECKIN "\") Unable to create string.\n"); + goto not_launchd; + } + + if ((checkin_response = launch_msg(checkin_request)) == NULL) { + fprintf(stderr,"launch_msg(\"" LAUNCH_KEY_CHECKIN "\") IPC failure: %s\n",strerror(errno)); + goto not_launchd; + } + + if (LAUNCH_DATA_ERRNO == launch_data_get_type(checkin_response)) { + // ignore EACCES, which is common if we weren't started by launchd + if (launch_data_get_errno(checkin_response) != EACCES) + fprintf(stderr,"launchd check-in failed: %s\n",strerror(launch_data_get_errno(checkin_response))); + goto not_launchd; + } + + sockets_dict = launch_data_dict_lookup(checkin_response, LAUNCH_JOBKEY_SOCKETS); + if (NULL == sockets_dict) { + fprintf(stderr,"launchd check-in: no sockets found to answer requests on!\n"); + goto not_launchd; + } + + if (launch_data_dict_get_count(sockets_dict) > 1) { + fprintf(stderr,"launchd check-in: some sockets will be ignored!\n"); + goto not_launchd; + } + + listening_fd_array = launch_data_dict_lookup(sockets_dict, ":0"); + if (NULL == listening_fd_array) { + fprintf(stderr,"launchd check-in: No known sockets found to answer requests on!\n"); + goto not_launchd; + } + + if (launch_data_array_get_count(listening_fd_array)!=1) { + fprintf(stderr,"launchd check-in: Expected 1 socket from launchd, got %d)\n", + launch_data_array_get_count(listening_fd_array)); + goto not_launchd; + } + + listening_fd=launch_data_array_get_index(listening_fd_array, 0); + launchd_fd=launch_data_get_fd(listening_fd); + fprintf(stderr,"Xquartz: run by launchd for fd %d\n",launchd_fd); + if((ciptr = TRANS(ReopenCOTSServer(TRANS_SOCKET_LOCAL_INDEX, + launchd_fd, getenv("DISPLAY"))))==NULL) + fprintf(stderr,"Got NULL while trying to Reopen launchd port\n"); + else temp_ciptrs[(*count_ret)++] = ciptr; + +not_launchd: +#endif + for (i = 0; i < NUMTRANS; i++) { Xtransport *trans = Xtransports[i].transport; @@ -1316,7 +1385,7 @@ static int TRANS(WriteV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt) #endif /* CRAY */ -#if (defined(SYSV) && defined(i386) && !defined(__SCO__) && !defined(sun)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__) +#if (defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__) /* * emulate readv @@ -1346,9 +1415,9 @@ static int TRANS(ReadV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt) return total; } -#endif /* SYSV && i386 || WIN32 || __sxg__ */ +#endif /* SYSV && __i386__ || WIN32 || __sxg__ */ -#if (defined(SYSV) && defined(i386) && !defined(__SCO__) && !defined(sun)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__) +#if (defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__) /* * emulate writev @@ -1378,7 +1447,7 @@ static int TRANS(WriteV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt) return total; } -#endif /* SYSV && i386 || WIN32 || __sxg__ */ +#endif /* SYSV && __i386__ || WIN32 || __sxg__ */ #if (defined(_POSIX_SOURCE) && !defined(AIXV3) && !defined(__QNX__)) || defined(hpux) || defined(USG) || defined(SVR4) || defined(__SCO__) diff --git a/lib/libxtrans/Xtrans.h b/lib/libxtrans/Xtrans.h index e8d4bdfcd..42def323b 100644 --- a/lib/libxtrans/Xtrans.h +++ b/lib/libxtrans/Xtrans.h @@ -1,4 +1,3 @@ -/* $Xorg: Xtrans.h,v 1.4 2001/02/09 02:04:06 xorgcvs Exp $ */ /* Copyright 1993, 1994, 1998 The Open Group @@ -25,10 +24,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. -*/ -/* $XFree86: xc/lib/xtrans/Xtrans.h,v 3.21 2003/07/20 16:12:15 tsi Exp $ */ - -/* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA + * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA * * All Rights Reserved * diff --git a/lib/libxtrans/Xtransdnet.c b/lib/libxtrans/Xtransdnet.c index ac91695c7..5e8d0088b 100644 --- a/lib/libxtrans/Xtransdnet.c +++ b/lib/libxtrans/Xtransdnet.c @@ -1,4 +1,3 @@ -/* $Xorg: Xtransdnet.c,v 1.4 2001/02/09 02:04:06 xorgcvs Exp $ */ /* Copyright 1993, 1994, 1998 The Open Group @@ -25,10 +24,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. -*/ -/* $XFree86: xc/lib/xtrans/Xtransdnet.c,v 3.7tsi Exp $ */ - -/* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA + * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA * * All Rights Reserved * diff --git a/lib/libxtrans/Xtransint.h b/lib/libxtrans/Xtransint.h index 663c689f5..317dbf8cc 100644 --- a/lib/libxtrans/Xtransint.h +++ b/lib/libxtrans/Xtransint.h @@ -1,5 +1,3 @@ -/* $XdotOrg: xc/lib/xtrans/Xtransint.h,v 1.2 2004/04/23 18:44:27 eich Exp $ */ -/* $Xorg: Xtransint.h,v 1.4 2001/02/09 02:04:06 xorgcvs Exp $ */ /* Copyright 1993, 1994, 1998 The Open Group @@ -26,10 +24,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. -*/ -/* $XFree86: xc/lib/xtrans/Xtransint.h,v 3.41 2003/08/28 00:35:23 tsi Exp $ */ - -/* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA + * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA * * All Rights Reserved * @@ -374,16 +369,17 @@ typedef struct _Xtransport_table { #define TRANS_DISABLED (1<<2) /* Don't open this one */ #define TRANS_NOLISTEN (1<<3) /* Don't listen on this one */ #define TRANS_NOUNLINK (1<<4) /* Dont unlink transport endpoints */ +#define TRANS_ABSTRACT (1<<5) /* Use abstract sockets if available */ /* Flags to preserve when setting others */ -#define TRANS_KEEPFLAGS (TRANS_NOUNLINK) +#define TRANS_KEEPFLAGS (TRANS_NOUNLINK|TRANS_ABSTRACT) /* * readv() and writev() don't exist or don't work correctly on some * systems, so they may be emulated. */ -#if defined(CRAY) || (defined(SYSV) && defined(i386) && !defined(__SCO__) && !defined(sun)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__) +#if defined(CRAY) || (defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__) #define READV(ciptr, iov, iovcnt) TRANS(ReadV)(ciptr, iov, iovcnt) @@ -397,10 +393,10 @@ static int TRANS(ReadV)( #define READV(ciptr, iov, iovcnt) readv(ciptr->fd, iov, iovcnt) -#endif /* CRAY || (SYSV && i386) || WIN32 || __sxg__ || */ +#endif /* CRAY || (SYSV && __i386__) || WIN32 || __sxg__ || */ -#if defined(CRAY) || (defined(SYSV) && defined(i386) && !defined(__SCO__) && !defined(sun)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__) +#if defined(CRAY) || (defined(SYSV) && defined(__i386__) && !defined(__SCO__) && !defined(sun)) || defined(WIN32) || defined(__sxg__) || defined(__UNIXOS2__) #define WRITEV(ciptr, iov, iovcnt) TRANS(WriteV)(ciptr, iov, iovcnt) diff --git a/lib/libxtrans/Xtranslcl.c b/lib/libxtrans/Xtranslcl.c index ef846a4d3..0127d6771 100644 --- a/lib/libxtrans/Xtranslcl.c +++ b/lib/libxtrans/Xtranslcl.c @@ -1,4 +1,3 @@ -/* $Xorg: Xtranslcl.c,v 1.6 2001/02/09 02:04:06 xorgcvs Exp $ */ /* Copyright 1993, 1994, 1998 The Open Group @@ -25,10 +24,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. -*/ -/* $XFree86: xc/lib/xtrans/Xtranslcl.c,v 3.40tsi Exp $ */ - -/* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA + * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA * * All Rights Reserved * @@ -846,7 +842,7 @@ TRANS(NAMEDOpenServer)(XtransConnInfo ciptr, char *port) NAMEDNODENAME, port); } } else { - (void) sprintf(server_path, sizeof(server_path), "%s%ld", + (void) snprintf(server_path, sizeof(server_path), "%s%ld", NAMEDNODENAME, (long)getpid()); } diff --git a/lib/libxtrans/Xtranssock.c b/lib/libxtrans/Xtranssock.c index aac43ddca..84c68b1e9 100644 --- a/lib/libxtrans/Xtranssock.c +++ b/lib/libxtrans/Xtranssock.c @@ -1,5 +1,3 @@ -/* $XdotOrg: lib/xtrans/Xtranssock.c,v 1.11 2005/11/08 06:33:26 jkj Exp $ */ -/* $Xorg: Xtranssock.c,v 1.11 2001/02/09 02:04:06 xorgcvs Exp $ */ /* Copyright 1993, 1994, 1998 The Open Group @@ -27,10 +25,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the copyright holders. -*/ -/* $XFree86: xc/lib/xtrans/Xtranssock.c,v 3.68 2004/01/07 04:28:02 dawes Exp $ */ - -/* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA + * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA * * All Rights Reserved * @@ -103,11 +98,11 @@ from the copyright holders. #include <sys/filio.h> #endif -#if (defined(i386) && defined(SYSV)) && !defined(SCO325) && !defined(sun) +#if (defined(__i386__) && defined(SYSV)) && !defined(SCO325) && !defined(sun) #include <net/errno.h> #endif -#if (defined(i386) && defined(SYSV)) && (!defined(ISC) || !defined(I_NREAD) || defined(SCO325)) || defined(_SEQUENT_) +#if (defined(__i386__) && defined(SYSV)) && (!defined(ISC) || !defined(I_NREAD) || defined(SCO325)) || defined(_SEQUENT_) #include <sys/stropts.h> #endif @@ -163,6 +158,10 @@ static int IBMsockInit = 0; #define SocketInitOnce() /**/ #endif +#ifdef linux +#define HAVE_ABSTRACT_SOCKETS +#endif + #define MIN_BACKLOG 128 #ifdef SOMAXCONN #if SOMAXCONN > MIN_BACKLOG @@ -172,6 +171,7 @@ static int IBMsockInit = 0; #ifndef BACKLOG #define BACKLOG MIN_BACKLOG #endif + /* * This is the Socket implementation of the X Transport service layer * @@ -281,6 +281,14 @@ static int TRANS(SocketINETClose) (XtransConnInfo ciptr); #define MAXHOSTNAMELEN 255 #endif +#if defined HAVE_SOCKLEN_T || (defined(IPv6) && defined(AF_INET6)) +# define SOCKLEN_T socklen_t +#elif defined(SVR4) || defined(__SCO__) +# define SOCKLEN_T size_t +#else +# define SOCKLEN_T int +#endif + /* * This provides compatibility for apps linked against system libraries * that don't have IPv6 support. @@ -327,11 +335,7 @@ TRANS(SocketINETGetAddr) (XtransConnInfo ciptr) #endif struct sockaddr_in socknamev4; void *socknamePtr; -#if defined(SVR4) || defined(__SCO__) - size_t namelen; -#else - int namelen; -#endif + SOCKLEN_T namelen; PRMSG (3,"SocketINETGetAddr(%p)\n", ciptr, 0, 0); @@ -404,11 +408,7 @@ TRANS(SocketINETGetPeerAddr) (XtransConnInfo ciptr) #endif struct sockaddr_in socknamev4; void *socknamePtr; -#if defined(SVR4) || defined(__SCO__) - size_t namelen; -#else - int namelen; -#endif + SOCKLEN_T namelen; #if defined(IPv6) && defined(AF_INET6) if (haveIPv6 && ciptr->family == AF_INET6) @@ -523,18 +523,67 @@ TRANS(SocketReopen) (int i, int type, int fd, char *port) { XtransConnInfo ciptr; + int portlen; + struct sockaddr *addr; PRMSG (3,"SocketReopen(%d,%d,%s)\n", type, fd, port); + if (port == NULL) { + PRMSG (1, "SocketReopen: port was null!\n", 0, 0, 0); + return NULL; + } + + portlen = strlen(port) + 1; // include space for trailing null +#ifdef SOCK_MAXADDRLEN + if (portlen < 0 || portlen > (SOCK_MAXADDRLEN + 2)) { + PRMSG (1, "SocketReopen: invalid portlen %d\n", portlen, 0, 0); + return NULL; + } + if (portlen < 14) portlen = 14; +#else + if (portlen < 0 || portlen > 14) { + PRMSG (1, "SocketReopen: invalid portlen %d\n", portlen, 0, 0); + return NULL; + } +#endif /*SOCK_MAXADDRLEN*/ + if ((ciptr = (XtransConnInfo) xcalloc ( 1, sizeof(struct _XtransConnInfo))) == NULL) { - PRMSG (1, "SocketReopen: malloc failed\n", 0, 0, 0); + PRMSG (1, "SocketReopen: malloc(ciptr) failed\n", 0, 0, 0); return NULL; } ciptr->fd = fd; + if ((addr = (struct sockaddr *) xcalloc (1, portlen + 2)) == NULL) { + PRMSG (1, "SocketReopen: malloc(addr) failed\n", 0, 0, 0); + return NULL; + } + ciptr->addr = addr; + ciptr->addrlen = portlen + 2; + + if ((ciptr->peeraddr = (struct sockaddr *) xcalloc (1, portlen + 2)) == NULL) { + PRMSG (1, "SocketReopen: malloc(portaddr) failed\n", 0, 0, 0); + return NULL; + } + ciptr->peeraddrlen = portlen + 2; + + /* Initialize ciptr structure as if it were a normally-opened unix socket */ + ciptr->flags = TRANS_LOCAL | TRANS_NOUNLINK; +#ifdef BSD44SOCKETS + addr->sa_len = portlen + 1; +#endif + addr->sa_family = AF_UNIX; +#ifdef HAS_STRLCPY + strlcpy(addr->sa_data, port, portlen); +#else + strncpy(addr->sa_data, port, portlen); +#endif + ciptr->family = AF_UNIX; + memcpy(ciptr->peeraddr, ciptr->addr, sizeof(struct sockaddr)); + ciptr->port = rindex(addr->sa_data, ':'); + if (ciptr->port[0] == ':') ciptr->port++; /* port should now point to portnum or NULL */ return ciptr; } @@ -829,23 +878,28 @@ TRANS(SocketSetOption) (XtransConnInfo ciptr, int option, int arg) #ifdef UNIXCONN static int -set_sun_path(const char *port, const char *upath, char *path) +set_sun_path(const char *port, const char *upath, char *path, int abstract) { struct sockaddr_un s; int maxlen = sizeof(s.sun_path) - 1; + const char *at = ""; if (!port || !*port || !path) return -1; - if (*port == '/') { /* a full pathname */ - if (strlen(port) > maxlen) - return -1; - snprintf(path, maxlen+1, "%s", port); - } else { - if (strlen(port) + strlen(upath) > maxlen) - return -1; - snprintf(path, maxlen+1, "%s%s", upath, port); - } +#ifdef HAVE_ABSTRACT_SOCKETS + if (port[0] == '@') + upath = ""; + else if (abstract) + at = "@"; +#endif + + if (*port == '/') /* a full pathname */ + upath = ""; + + if (strlen(port) + strlen(upath) > maxlen) + return -1; + snprintf(path, maxlen+1, "%s%s%s", at, upath, port); return 0; } #endif @@ -858,7 +912,7 @@ TRANS(SocketCreateListener) (XtransConnInfo ciptr, int socknamelen, unsigned int flags) { - int namelen = socknamelen; + SOCKLEN_T namelen = socknamelen; int fd = ciptr->fd; int retry; @@ -938,7 +992,7 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int struct sockaddr_in sockname; #endif unsigned short sport; - int namelen = sizeof(sockname); + SOCKLEN_T namelen = sizeof(sockname); int status; long tmpport; #ifdef XTHREADS_NEEDS_BYNAMEPARAMS @@ -1068,6 +1122,12 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port, int oldUmask; int status; unsigned int mode; + char tmpport[108]; + + int abstract = 0; +#ifdef HAVE_ABSTRACT_SOCKETS + abstract = ciptr->transptr->flags & TRANS_ABSTRACT; +#endif PRMSG (2, "SocketUNIXCreateListener(%s)\n", port ? port : "NULL", 0, 0); @@ -1090,16 +1150,16 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port, } #endif + memset(&sockname, 0, sizeof(sockname)); sockname.sun_family = AF_UNIX; - if (port && *port) { - if (set_sun_path(port, UNIX_PATH, sockname.sun_path) != 0) { - PRMSG (1, "SocketUNIXCreateListener: path too long\n", 0, 0, 0); - return TRANS_CREATE_LISTENER_FAILED; - } - } else { - snprintf (sockname.sun_path, sizeof(sockname.sun_path), - "%s%ld", UNIX_PATH, (long)getpid()); + if (!(port && *port)) { + snprintf (tmpport, sizeof(tmpport), "%s%ld", UNIX_PATH, (long)getpid()); + port = tmpport; + } + if (set_sun_path(port, UNIX_PATH, sockname.sun_path, abstract) != 0) { + PRMSG (1, "SocketUNIXCreateListener: path too long\n", 0, 0, 0); + return TRANS_CREATE_LISTENER_FAILED; } #if (defined(BSD44SOCKETS) || defined(__UNIXWARE__)) && !defined(Lynx) @@ -1112,7 +1172,12 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port, namelen = strlen(sockname.sun_path) + offsetof(struct sockaddr_un, sun_path); #endif - unlink (sockname.sun_path); + if (abstract) { + sockname.sun_path[0] = '\0'; + namelen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&sockname.sun_path[1]); + } + else + unlink (sockname.sun_path); if ((status = TRANS(SocketCreateListener) (ciptr, (struct sockaddr *) &sockname, namelen, flags)) < 0) @@ -1142,6 +1207,9 @@ TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, char *port, return TRANS_CREATE_LISTENER_FAILED; } + if (abstract) + sockname.sun_path[0] = '@'; + ciptr->family = sockname.sun_family; ciptr->addrlen = namelen; memcpy (ciptr->addr, &sockname, ciptr->addrlen); @@ -1164,16 +1232,22 @@ TRANS(SocketUNIXResetListener) (XtransConnInfo ciptr) struct stat statb; int status = TRANS_RESET_NOOP; unsigned int mode; + int abstract = 0; +#ifdef HAVE_ABSTRACT_SOCKETS + abstract = ciptr->transptr->flags & TRANS_ABSTRACT; +#endif PRMSG (3, "SocketUNIXResetListener(%p,%d)\n", ciptr, ciptr->fd, 0); - if (stat (unsock->sun_path, &statb) == -1 || + if (!abstract && ( + stat (unsock->sun_path, &statb) == -1 || ((statb.st_mode & S_IFMT) != #if (defined (sun) && defined(SVR4)) || defined(NCR) || defined(SCO325) || !defined(S_IFSOCK) - S_IFIFO)) + S_IFIFO #else - S_IFSOCK)) + S_IFSOCK #endif + ))) { int oldUmask = umask (0); @@ -1235,7 +1309,7 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status) { XtransConnInfo newciptr; struct sockaddr_in sockname; - int namelen = sizeof(sockname); + SOCKLEN_T namelen = sizeof(sockname); PRMSG (2, "SocketINETAccept(%p,%d)\n", ciptr, ciptr->fd, 0); @@ -1314,11 +1388,7 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) { XtransConnInfo newciptr; struct sockaddr_un sockname; -#if defined(SVR4) || defined(__SCO__) - size_t namelen = sizeof sockname; -#else - int namelen = sizeof sockname; -#endif + SOCKLEN_T namelen = sizeof sockname; PRMSG (2, "SocketUNIXAccept(%p,%d)\n", ciptr, ciptr->fd, 0); @@ -1339,6 +1409,7 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) return NULL; } + ciptr->addrlen = namelen; /* * Get the socket name and the peer name from the listener socket, * since this is unix domain. @@ -1355,6 +1426,10 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) return NULL; } + /* + * if the socket is abstract, we already modified the address to have a + * @ instead of the initial NUL, so no need to do that again here. + */ newciptr->addrlen = ciptr->addrlen; memcpy (newciptr->addr, ciptr->addr, newciptr->addrlen); @@ -1941,13 +2016,17 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port) { struct sockaddr_un sockname; - int namelen; + SOCKLEN_T namelen; #if defined(hpux) && defined(X11_t) struct sockaddr_un old_sockname; - int old_namelen; + SOCKLEN_T old_namelen; #endif + int abstract = 0; +#ifdef HAVE_ABSTRACT_SOCKETS + abstract = ciptr->transptr->flags & TRANS_ABSTRACT; +#endif PRMSG (2,"SocketUNIXConnect(%d,%s,%s)\n", ciptr->fd, host, port); @@ -1959,7 +2038,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port) * we know for sure it will fail. */ - if (strcmp (host, "unix") != 0 && !UnixHostReallyLocal (host)) + if (host && *host && host[0]!='/' && strcmp (host, "unix") != 0 && !UnixHostReallyLocal (host)) { PRMSG (1, "SocketUNIXConnect: Cannot connect to non-local host %s\n", @@ -1985,7 +2064,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port) sockname.sun_family = AF_UNIX; - if (set_sun_path(port, UNIX_PATH, sockname.sun_path) != 0) { + if (set_sun_path(port, UNIX_PATH, sockname.sun_path, abstract) != 0) { PRMSG (1, "SocketUNIXConnect: path too long\n", 0, 0, 0); return TRANS_CONNECT_FAILED; } @@ -2006,7 +2085,7 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port) * This is gross, but it was in Xlib */ old_sockname.sun_family = AF_UNIX; - if (set_sun_path(port, OLD_UNIX_PATH, old_sockname.sun_path) != 0) { + if (set_sun_path(port, OLD_UNIX_PATH, old_sockname.sun_path, abstract) != 0) { PRMSG (1, "SocketUNIXConnect: path too long\n", 0, 0, 0); return TRANS_CONNECT_FAILED; } @@ -2014,6 +2093,17 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port) offsetof(struct sockaddr_un, sun_path); #endif + /* + * Adjust the socket path if using abstract sockets. + * Done here because otherwise all the strlen() calls above would fail. + */ + + if (abstract) { + sockname.sun_path[0] = '\0'; +#if defined(hpux) && defined(X11_t) + old_sockname.sun_path[0] = '\0'; +#endif + } /* * Do the connect() @@ -2041,8 +2131,13 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port) errno = olderrno; /* - * If the error was ENOENT, the server may be starting up - * and we should try again. + * If the error was ENOENT, the server may be starting up; we used + * to suggest to try again in this case with + * TRANS_TRY_CONNECT_AGAIN, but this introduced problems for + * processes still referencing stale sockets in their environment. + * Hence, we now return a hard error, TRANS_CONNECT_FAILED, and it + * is suggested that higher level stacks handle retries on their + * level when they face a slow starting server. * * If the error was EWOULDBLOCK or EINPROGRESS then the socket * was non-blocking and we should poll using select @@ -2051,12 +2146,19 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port) * should try again. */ - if (olderrno == ENOENT || olderrno == EINTR) - return TRANS_TRY_CONNECT_AGAIN; - else if (olderrno == EWOULDBLOCK || olderrno == EINPROGRESS) + if (olderrno == EWOULDBLOCK || olderrno == EINPROGRESS) return TRANS_IN_PROGRESS; - else - { + else if (olderrno == EINTR) + return TRANS_TRY_CONNECT_AGAIN; + else if (olderrno == ENOENT) { + /* If opening as abstract socket failed, try again normally */ + if (abstract) { + ciptr->transptr->flags &= ~(TRANS_ABSTRACT); + return TRANS_TRY_CONNECT_AGAIN; + } else { + return TRANS_CONNECT_FAILED; + } + } else { PRMSG (2,"SocketUNIXConnect: Can't connect: errno = %d\n", EGET(),0, 0); @@ -2079,12 +2181,15 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char *host, char *port) return TRANS_CONNECT_FAILED; } + if (abstract) + sockname.sun_path[0] = '@'; + ciptr->family = AF_UNIX; ciptr->addrlen = namelen; ciptr->peeraddrlen = namelen; memcpy (ciptr->addr, &sockname, ciptr->addrlen); memcpy (ciptr->peeraddr, &sockname, ciptr->peeraddrlen); - + return 0; } @@ -2105,11 +2210,11 @@ TRANS(SocketBytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend) #ifdef WIN32 { int ret = ioctlsocket ((SOCKET) ciptr->fd, FIONREAD, (u_long *) pend); - errno = WSAGetLastError(); + if (ret == SOCKET_ERROR) errno = WSAGetLastError(); return ret; } #else -#if (defined(i386) && defined(SYSV) && !defined(SCO325)) || (defined(_SEQUENT_) && _SOCKET_VERSION == 1) +#if (defined(__i386__) && defined(SYSV) && !defined(SCO325)) || (defined(_SEQUENT_) && _SOCKET_VERSION == 1) return ioctl (ciptr->fd, I_NREAD, (char *) pend); #else #if defined(__UNIXOS2__) @@ -2117,7 +2222,7 @@ TRANS(SocketBytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend) #else return ioctl (ciptr->fd, FIONREAD, (char *) pend); #endif /* __UNIXOS2__ */ -#endif /* i386 && SYSV || _SEQUENT_ && _SOCKET_VERSION == 1 */ +#endif /* __i386__ && SYSV || _SEQUENT_ && _SOCKET_VERSION == 1 */ #endif /* WIN32 */ } @@ -2132,7 +2237,7 @@ TRANS(SocketRead) (XtransConnInfo ciptr, char *buf, int size) { int ret = recv ((SOCKET)ciptr->fd, buf, size, 0); #ifdef WIN32 - errno = WSAGetLastError(); + if (ret == SOCKET_ERROR) errno = WSAGetLastError(); #endif return ret; } @@ -2152,7 +2257,7 @@ TRANS(SocketWrite) (XtransConnInfo ciptr, char *buf, int size) { int ret = send ((SOCKET)ciptr->fd, buf, size, 0); #ifdef WIN32 - errno = WSAGetLastError(); + if (ret == SOCKET_ERROR) errno = WSAGetLastError(); #endif return ret; } @@ -2191,7 +2296,7 @@ TRANS(SocketDisconnect) (XtransConnInfo ciptr) #ifdef WIN32 { int ret = shutdown (ciptr->fd, 2); - errno = WSAGetLastError(); + if (ret == SOCKET_ERROR) errno = WSAGetLastError(); return ret; } #else @@ -2210,7 +2315,7 @@ TRANS(SocketINETClose) (XtransConnInfo ciptr) #ifdef WIN32 { int ret = close (ciptr->fd); - errno = WSAGetLastError(); + if (ret == SOCKET_ERROR) errno = WSAGetLastError(); return ret; } #else @@ -2224,7 +2329,6 @@ TRANS(SocketINETClose) (XtransConnInfo ciptr) #ifdef UNIXCONN static int TRANS(SocketUNIXClose) (XtransConnInfo ciptr) - { /* * If this is the server side, then once the socket is closed, @@ -2243,7 +2347,8 @@ TRANS(SocketUNIXClose) (XtransConnInfo ciptr) && sockname->sun_family == AF_UNIX && sockname->sun_path[0]) { - if (!(ciptr->flags & TRANS_NOUNLINK)) + if (!(ciptr->flags & TRANS_NOUNLINK + || ciptr->transptr->flags & TRANS_ABSTRACT)) unlink (sockname->sun_path); } @@ -2410,7 +2515,11 @@ Xtransport TRANS(SocketINET6Funcs) = { Xtransport TRANS(SocketLocalFuncs) = { /* Socket Interface */ "local", +#ifdef HAVE_ABSTRACT_SOCKETS + TRANS_ABSTRACT, +#else 0, +#endif #ifdef TRANS_CLIENT TRANS(SocketOpenCOTSClient), #endif /* TRANS_CLIENT */ @@ -2456,7 +2565,7 @@ static char* unix_nolisten[] = { "local" , NULL }; Xtransport TRANS(SocketUNIXFuncs) = { /* Socket Interface */ "unix", -#if !defined(LOCALCONN) +#if !defined(LOCALCONN) && !defined(HAVE_ABSTRACT_SOCKETS) TRANS_ALIAS, #else 0, diff --git a/lib/libxtrans/Xtranstli.c b/lib/libxtrans/Xtranstli.c index d8b5db83b..a9dfc21da 100644 --- a/lib/libxtrans/Xtranstli.c +++ b/lib/libxtrans/Xtranstli.c @@ -1,4 +1,3 @@ -/* $Xorg: Xtranstli.c,v 1.4 2001/02/09 02:04:07 xorgcvs Exp $ */ /* Copyright 1993, 1994, 1998 The Open Group @@ -25,10 +24,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. -*/ -/* $XFree86: xc/lib/xtrans/Xtranstli.c,v 3.12tsi Exp $ */ - -/* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA + * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA * * All Rights Reserved * diff --git a/lib/libxtrans/Xtransutil.c b/lib/libxtrans/Xtransutil.c index cd090f70c..287c3f244 100644 --- a/lib/libxtrans/Xtransutil.c +++ b/lib/libxtrans/Xtransutil.c @@ -1,4 +1,3 @@ -/* $Xorg: Xtransutil.c,v 1.4 2001/02/09 02:04:07 xorgcvs Exp $ */ /* Copyright 1993, 1994, 1998 The Open Group @@ -25,10 +24,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. -*/ -/* $XFree86: xc/lib/xtrans/Xtransutil.c,v 3.26 2003/07/09 15:27:30 tsi Exp $ */ - -/* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA + * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA * * All Rights Reserved * @@ -61,6 +57,10 @@ from The Open Group. #ifdef XTHREADS #include <X11/Xthreads.h> #endif +#ifdef WIN32 +#include <X11/Xlibint.h> +#include <X11/Xwinsock.h> +#endif #ifdef X11_t @@ -487,7 +487,7 @@ TRANS(WSAStartup) (void) PRMSG (2,"WSAStartup()\n", 0, 0, 0); - if (!wsadata.wVersion && WSAStartup(0x0101, &wsadata)) + if (!wsadata.wVersion && WSAStartup(MAKEWORD(2,2), &wsadata)) return 1; return 0; } @@ -664,8 +664,10 @@ trans_mkdir(char *path, int mode) return -1; } #endif +#ifndef __APPLE_CC__ PRMSG(1, "mkdir: Owner of %s should be set to root\n", path, 0, 0); +#endif } if (updateMode && !updatedMode) { diff --git a/lib/libxtrans/aclocal.m4 b/lib/libxtrans/aclocal.m4 index 9b1de4fc2..825cc938f 100644 --- a/lib/libxtrans/aclocal.m4 +++ b/lib/libxtrans/aclocal.m4 @@ -871,14 +871,14 @@ AC_DEFUN([XORG_RELEASE_VERSION],[ AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR], [`echo $PACKAGE_VERSION | cut -d . -f 1`], [Major version of this package]) - PVM=`echo $PACKAGE_VERSION | cut -d . -f 2` + PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1` if test "x$PVM" = "x"; then PVM="0" fi AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR], [$PVM], [Minor version of this package]) - PVP=`echo $PACKAGE_VERSION | cut -d . -f 3` + PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1` if test "x$PVP" = "x"; then PVP="0" fi diff --git a/lib/libxtrans/configure b/lib/libxtrans/configure index 56aea7e04..e35b5b591 100644 --- a/lib/libxtrans/configure +++ b/lib/libxtrans/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for xtrans 1.0.4. +# Generated by GNU Autoconf 2.59 for xtrans 1.2. # # Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>. # @@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='xtrans' PACKAGE_TARNAME='xtrans' -PACKAGE_VERSION='1.0.4' -PACKAGE_STRING='xtrans 1.0.4' +PACKAGE_VERSION='1.2' +PACKAGE_STRING='xtrans 1.2' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg' ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE fchown_define sticky_bit_define LIBOBJS LTLIBOBJS' @@ -738,7 +738,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures xtrans 1.0.4 to adapt to many kinds of systems. +\`configure' configures xtrans 1.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -800,7 +800,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of xtrans 1.0.4:";; + short | recursive ) echo "Configuration of xtrans 1.2:";; esac cat <<\_ACEOF @@ -925,7 +925,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -xtrans configure 1.0.4 +xtrans configure 1.2 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -939,7 +939,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by xtrans $as_me 1.0.4, which was +It was created by xtrans $as_me 1.2, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1537,7 +1537,7 @@ fi # Define the identity of the package. PACKAGE='xtrans' - VERSION='1.0.4' + VERSION='1.2' cat >>confdefs.h <<_ACEOF @@ -2930,7 +2930,7 @@ cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION_MAJOR `echo $PACKAGE_VERSION | cut -d . -f 1` _ACEOF - PVM=`echo $PACKAGE_VERSION | cut -d . -f 2` + PVM=`echo $PACKAGE_VERSION | cut -d . -f 2 | cut -d - -f 1` if test "x$PVM" = "x"; then PVM="0" fi @@ -2939,7 +2939,7 @@ cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION_MINOR $PVM _ACEOF - PVP=`echo $PACKAGE_VERSION | cut -d . -f 3` + PVP=`echo $PACKAGE_VERSION | cut -d . -f 3 | cut -d - -f 1` if test "x$PVP" = "x"; then PVP="0" fi @@ -3365,7 +3365,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by xtrans $as_me 1.0.4, which was +This file was extended by xtrans $as_me 1.2, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -3423,7 +3423,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -xtrans config.status 1.0.4 +xtrans config.status 1.2 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/lib/libxtrans/configure.ac b/lib/libxtrans/configure.ac index bb9d4bc46..304fd6bc6 100644 --- a/lib/libxtrans/configure.ac +++ b/lib/libxtrans/configure.ac @@ -1,6 +1,3 @@ -dnl -dnl $Id: configure.ac,v 1.1 2006/11/25 18:26:23 matthieu Exp $ -dnl dnl Copyright © 2003 Keith Packard, Noah Levitt dnl dnl Permission to use, copy, modify, distribute, and sell this software and its @@ -24,7 +21,7 @@ dnl dnl Process this file with autoconf to create configure. AC_PREREQ([2.57]) -AC_INIT(xtrans, 1.0.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xtrans) +AC_INIT(xtrans, 1.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xtrans) AM_INIT_AUTOMAKE([dist-bzip2]) AM_MAINTAINER_MODE diff --git a/lib/libxtrans/transport.c b/lib/libxtrans/transport.c index ff460c257..0d1eaf95b 100644 --- a/lib/libxtrans/transport.c +++ b/lib/libxtrans/transport.c @@ -1,4 +1,3 @@ -/* $Xorg: transport.c,v 1.4 2001/02/09 02:04:07 xorgcvs Exp $ */ /* Copyright 1993, 1994, 1998 The Open Group @@ -25,10 +24,7 @@ not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. -*/ -/* $XFree86: xc/lib/xtrans/transport.c,v 3.9 2002/05/31 18:45:51 dawes Exp $ */ - -/* Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA + * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA * * All Rights Reserved * diff --git a/lib/libxtrans/xtrans.m4 b/lib/libxtrans/xtrans.m4 index 1d80595ad..31d456b41 100644 --- a/lib/libxtrans/xtrans.m4 +++ b/lib/libxtrans/xtrans.m4 @@ -52,6 +52,12 @@ AC_DEFUN([XTRANS_TCP_FLAGS],[ #include <sys/socket.h> #include <netinet/in.h> ]) + + # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc. + AC_CHECK_TYPES([socklen_t], [], [], [ +AC_INCLUDES_DEFAULT +#include <sys/socket.h>]) + ]) # XTRANS_TCP_FLAGS # XTRANS_CONNECTION_FLAGS() @@ -61,17 +67,21 @@ AC_DEFUN([XTRANS_TCP_FLAGS],[ AC_DEFUN([XTRANS_CONNECTION_FLAGS],[ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_TYPE_SIGNAL]) + [case $host_os in + mingw*) unixdef="no" ;; + *) unixdef="yes" ;; + esac] AC_ARG_ENABLE(unix-transport, AC_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]), - [UNIXCONN=$enableval], [UNIXCONN=yes]) - AC_ARG_ENABLE(tcp-transport, - AC_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]), - [TCPCONN=$enableval], [TCPCONN=yes]) + [UNIXCONN=$enableval], [UNIXCONN=$unixdef]) AC_MSG_CHECKING([if Xtrans should support UNIX socket connections]) if test "$UNIXCONN" = "yes"; then AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections]) fi AC_MSG_RESULT($UNIXCONN) + AC_ARG_ENABLE(tcp-transport, + AC_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]), + [TCPCONN=$enableval], [TCPCONN=yes]) AC_MSG_CHECKING([if Xtrans should support TCP socket connections]) AC_MSG_RESULT($TCPCONN) if test "$TCPCONN" = "yes"; then |