From b898f415e7c31de5b4beb06b22a5498049852e53 Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Thu, 15 Dec 2022 14:43:37 -0500 Subject: Allow full paths to sockets on non-macOS This adds explicit checks for addresses that start with / or unix: and uses full paths in this case. Signed-off-by: Demi Marie Obenour --- Xtrans.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'Xtrans.c') diff --git a/Xtrans.c b/Xtrans.c index e88b597..b2b98a2 100644 --- a/Xtrans.c +++ b/Xtrans.c @@ -331,14 +331,26 @@ TRANS(ParseAddress) (const char *address, */ #endif + if (address != NULL) { + if (address[0] == '/') { + _protocol = "local"; + _host = ""; + _port = address; + } else #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; - } + /* 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; + } + } /* * Now that we have all of the components, allocate new -- cgit v1.2.3