libxtrans compilation broken on GNU/Linux

Nigel Cunningham nigel at nigel.suspend2.net
Sun Sep 9 15:57:08 PDT 2007


(Originally sent with the wrong From:, so the mailing list rejected it. Sorry 
Alan and Dodji for the duplicate)...

Hi.

On Sunday 09 September 2007 02:48:29 Alan Coopersmith wrote:
> Dodji Seketeli wrote:
> > In file Xtranssock.c, function SocketReopen(),
> > some new socket manipulation code has been added, and the socket
> > interface used is the BSD one. For instance, accessing
> > sockaddr::sa_len, or using the SOCK_MAXADDRLEN macro.
> > Well, there is also the use of strlcpy() that causes problem, and I am
> > not sure how to properly handle that either.
> > 
> > Are there some macros in the server to detect the style of the sockets
> > (BSD or not, for instance) so that I can just #ifdef the code
> > properly ? 
> 
> #ifdef BSD44SOCKETS is already sprinkled through xtrans for handling
> the sa_len presence check.
> 
> The XTRANS_TCP_FLAGS autoconf macro in xtrans.m4 sets it in the packages
> that use xtrans.

Something must still not be right, because I need the following to get app/xfs 
to compile. (Yeah, maybe it's a problem in xfs instead).

Regards,

Nigel

diff --git a/Xtranssock.c b/Xtranssock.c
index e989b42..ef7d8a3 100644
--- a/Xtranssock.c
+++ b/Xtranssock.c
@@ -529,11 +529,14 @@ TRANS(SocketReopen) (int i, int type, int fd, char 
*port)
 
 {
     XtransConnInfo	ciptr;
+#ifdef HAVE_LAUNCHD
     int portlen;
     struct sockaddr *addr;
+#endif
 
     PRMSG (3,"SocketReopen(%d,%d,%s)\n", type, fd, port);
 
+#ifdef HAVE_LAUNCHD
     if (port == NULL) {
       PRMSG (1, "SocketReopen: port was null!\n", 0, 0, 0);
       return NULL;
@@ -546,6 +549,7 @@ TRANS(SocketReopen) (int i, int type, int fd, char *port)
     }
     
     if (portlen < 14) portlen = 14;
+#endif
 
     if ((ciptr = (XtransConnInfo) xcalloc (
 	1, sizeof(struct _XtransConnInfo))) == NULL)
@@ -556,6 +560,7 @@ TRANS(SocketReopen) (int i, int type, int fd, char *port)
 
     ciptr->fd = fd;
 
+#ifdef HAVE_LAUNCHD
     if ((addr = (struct sockaddr *) xcalloc (1, portlen + 2)) == NULL) {
 	PRMSG (1, "SocketReopen: malloc(addr) failed\n", 0, 0, 0);
 	return NULL;
@@ -578,6 +583,7 @@ TRANS(SocketReopen) (int i, int type, int fd, char *port)
     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 */
+#endif
     return ciptr;
 }
 
@@ -1382,7 +1388,10 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int 
*status)
 	return NULL;
     }
 
+#ifdef HAVE_LAUNCHD
 	ciptr->addrlen = namelen;
+#endif
+
     /*
      * Get the socket name and the peer name from the listener socket,
      * since this is unix domain.
@@ -2008,7 +2017,11 @@ TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, char 
*host, char *port)
      * we know for sure it will fail.
      */
 
-    if (host && *host && host[0]!='/' && strcmp (host, "unix") != 0 
&& !UnixHostReallyLocal (host))
+    if (
+#ifdef HAVE_LAUNCHD
+	host && *host && host[0]!='/' &&
+#endif
+	strcmp (host, "unix") != 0 && !UnixHostReallyLocal (host))
     {
 	PRMSG (1,
 	   "SocketUNIXConnect: Cannot connect to non-local host %s\n",

-- 
See http://www.tuxonice.net for Howtos, FAQs, mailing
lists, wiki and bugzilla info.



More information about the xorg mailing list