summaryrefslogtreecommitdiff
path: root/Xtrans.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@herrb.eu>2023-06-15 16:58:45 +0200
committerMatthieu Herrb <matthieu@herrb.eu>2023-06-15 16:58:45 +0200
commit6ac755aff400873a2a62f18948f32a14d8725bd8 (patch)
tree83e0d80c1f4c04f1026b89f1012db67edd60252c /Xtrans.c
parent495fa1b46b2937e199052e1e40a2a2072dd11888 (diff)
parent3b3a3bd75d86aec78f6ef893b198c3efc378bc64 (diff)
Merge remote-tracking branch 'origin/master' into obsd
Diffstat (limited to 'Xtrans.c')
-rw-r--r--Xtrans.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/Xtrans.c b/Xtrans.c
index ef9f991..448f1c4 100644
--- a/Xtrans.c
+++ b/Xtrans.c
@@ -202,8 +202,8 @@ TRANS(ParseAddress) (const char *address,
* If a "::" is found then assume DNET.
*/
- char *mybuf, *tmpptr;
- const char *_protocol;
+ char *mybuf, *tmpptr = NULL;
+ const char *_protocol = NULL;
char *_host, *_port;
char hostnamebuf[256];
int _host_len;
@@ -211,6 +211,28 @@ TRANS(ParseAddress) (const char *address,
prmsg (3,"ParseAddress(%s)\n", address);
+ /* First, check for AF_UNIX socket paths */
+ if (address[0] == '/') {
+ _protocol = "local";
+ _host = "";
+ _port = address;
+ } else
+#ifdef HAVE_LAUNCHD
+ /* launchd sockets will look like 'local//tmp/launch-XgkNns/:0' */
+ if(!strncmp(address,"local//",7)) {
+ _protocol="local";
+ _host="";
+ _port=address+6;
+ } else
+#endif
+ if (!strncmp(address, "unix:", 5)) {
+ _protocol = "local";
+ _host = "";
+ _port = address + 5;
+ }
+ if (_protocol)
+ goto done_parsing;
+
/* Copy the string so it can be changed */
tmpptr = mybuf = strdup (address);
@@ -332,15 +354,7 @@ TRANS(ParseAddress) (const char *address,
*/
#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
-
+done_parsing:
/*
* Now that we have all of the components, allocate new
* string space for them.
@@ -1173,6 +1187,9 @@ TRANS(MakeAllCOTSServerListeners) (const char *port, int *partial,
if ((status = TRANS(CreateListener (ciptr, port, flags))) < 0)
{
+ if (*partial != 0)
+ continue;
+
if (status == TRANS_ADDR_IN_USE)
{
/*