Can't start X twice

Petr Salinger Petr.Salinger at t-systems.cz
Mon Nov 7 14:48:24 UTC 2005


> #if defined(BSD44SOCKETS) && !defined(Lynx)
>     sockname.sun_len = strlen(sockname.sun_path);
>     namelen = SUN_LEN(&sockname);
> #else
>     namelen = strlen(sockname.sun_path) + sizeof(sockname.sun_family);
> #endif
> 
> So the call to unlink happens with the correct path "/tmp/.X11-unix/X0" (as is 
> evident by the ktrace data). When the same argument is supplied to 
> SocketCreateListener the zero on the end get's lopped off, probably due to a 
> miscalculation of namelen. The BDS44SOCKETS conditional looks suspicious so 
> my first guess is that BSD44SOCKETS isn't getting defined on gnu/kfreebsd, 
> whereas it should. But as I checked out on the Xorg cvsweb the gnu.cf 
> configuration file does indeed specify HasBSD44Sockets. Perhaps then 
> BSD44SOCKETS should not be defined, or perhaps this is unrelated.

I think that linux.cf is used for kfreebsd.

The problem can be probably fixed also by properly calculating namelen,
by something like

#include <stddef.h>     /* standard place for definition offsetof */
#ifndef offsetof
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif
...
...

   namelen = strlen(sockname.sun_path) + offsetof(struct sockaddr_un, sun_path));

Petr




More information about the Glibc-bsd-devel mailing list