diff options
author | rws <empty> | 1989-10-12 13:20:03 +0000 |
---|---|---|
committer | rws <empty> | 1989-10-12 13:20:03 +0000 |
commit | f944dd4d5397ea0ed1de2d34fd0fd391395f6cb9 (patch) | |
tree | a7feff2eefde712192e26a13faf25801fbc82cab /xc/lib | |
parent | 63e457e3bc622d9ed5be96b768b3bf3ad675ed2a (diff) |
disgusting support for HP's unix socket name
Diffstat (limited to 'xc/lib')
-rw-r--r-- | xc/lib/X11/ConnDis.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/xc/lib/X11/ConnDis.c b/xc/lib/X11/ConnDis.c index 2fe6acdb0..346a8cfd9 100644 --- a/xc/lib/X11/ConnDis.c +++ b/xc/lib/X11/ConnDis.c @@ -1,5 +1,5 @@ /* - * $XConsortium: XConnDis.c,v 11.59 89/10/08 14:28:55 rws Exp $ + * $XConsortium: XConnDis.c,v 11.60 89/10/10 19:41:04 jim Exp $ * * Copyright 1989 Massachusetts Institute of Technology * @@ -416,7 +416,12 @@ static int MakeDECnetConnection (phostname, idisplay, retries, #include <sys/un.h> #ifndef X_UNIX_PATH +#ifdef hpux +#define X_UNIX_PATH "/usr/spool/sockets/X11/" +#define OLD_UNIX_PATH "/tmp/.X11-unix/X" +#else #define X_UNIX_PATH "/tmp/.X11-unix/X" +#endif #endif /* X_UNIX_PATH */ static int MakeUNIXSocketConnection (phostname, idisplay, retries, @@ -432,6 +437,11 @@ static int MakeUNIXSocketConnection (phostname, idisplay, retries, struct sockaddr *addr; /* generic socket pointer */ int addrlen; /* length of addr */ int fd; /* socket file descriptor */ +#ifdef hpux /* this is disgusting */ + struct sockaddr_un ounaddr; /* UNIX socket data block */ + struct sockaddr *oaddr; /* generic socket pointer */ + int oaddrlen; /* length of addr */ +#endif unaddr.sun_family = AF_UNIX; sprintf (unaddr.sun_path, "%s%d", X_UNIX_PATH, idisplay); @@ -439,6 +449,13 @@ static int MakeUNIXSocketConnection (phostname, idisplay, retries, addr = (struct sockaddr *) &unaddr; addrlen = strlen(unaddr.sun_path) + sizeof(unaddr.sun_family); +#ifdef hpux /* this is disgusting */ + ounaddr.sun_family = AF_UNIX; + sprintf (ounaddr.sun_path, "%s%d", OLD_UNIX_PATH, idisplay); + oaddr = (struct sockaddr *) &ounaddr; + oaddrlen = strlen(ounaddr.sun_path) + sizeof(ounaddr.sun_family); +#endif + /* * Open the network connection. */ @@ -450,6 +467,17 @@ static int MakeUNIXSocketConnection (phostname, idisplay, retries, if (connect (fd, addr, addrlen) < 0) { int olderrno = errno; (void) close (fd); +#ifdef hpux /* this is disgusting */ + if (olderrno == ENOENT) { + fd = socket ((int) oaddr->sa_family, SOCK_STREAM, 0); + if (fd >= 0) { + if (connect (fd, oaddr, oaddrlen) >= 0) + break; + olderrno = errno; + (void) close (fd); + } + } +#endif if (olderrno != ENOENT || retries <= 0) { errno = olderrno; return -1; |