summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDemi Marie Obenour <demiobenour@gmail.com>2022-12-15 14:43:37 -0500
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-03-19 18:07:21 +0000
commitb898f415e7c31de5b4beb06b22a5498049852e53 (patch)
tree897c6af86897678877932539ff96990153d121aa
parente24adec1203cd25423ab2835a5be4f6b828b72a5 (diff)
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 <demiobenour@gmail.com>
-rw-r--r--Xtrans.c24
1 files changed, 18 insertions, 6 deletions
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