summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Xtranssock.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Xtranssock.c b/Xtranssock.c
index eabb587..f36e3a6 100644
--- a/Xtranssock.c
+++ b/Xtranssock.c
@@ -528,7 +528,14 @@ TRANS(SocketReopen) (int i, int type, int fd, char *port)
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 */
+ if (ciptr->port == NULL) {
+ if (is_numeric(addr->sa_data)) {
+ ciptr->port = addr->sa_data;
+ }
+ } else if (ciptr->port[0] == ':') {
+ ciptr->port++;
+ }
+ /* port should now point to portnum or NULL */
return ciptr;
}