summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Williams <[email protected]>2020-10-08 12:57:27 +0100
committerAndrew Gallant <[email protected]>2020-10-08 09:26:10 -0400
commit5f9e7b3c49cdbee70f16f2e417cb8b473e20bc78 (patch)
treee75c22e6d368b1a413fafb957a02eba8e1f4e3d9
parent20f126ea2843845b1d723096b57310edc3a541d5 (diff)
Fix unix:0.0 connections
According to the spec at https://www.x.org/archive/X11R6.8.0/doc/Xorg.1.html#sect5 the DISPLAY string unix:0.0 is special. This forces connections to use the unix socket at this address even if they would normally lookup TCP first. Simple fix so that we fall through to the unix socket in this case.
-rw-r--r--conn.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/conn.go b/conn.go
index 1b7d838..f1b85c0 100644
--- a/conn.go
+++ b/conn.go
@@ -168,13 +168,14 @@ func (c *Conn) dial(display string) error {
// Connect to server
if len(socket) != 0 {
c.conn, err = net.Dial("unix", socket+":"+c.display)
- } else if len(c.host) != 0 {
+ } else if len(c.host) != 0 && c.host != "unix" {
if protocol == "" {
protocol = "tcp"
}
c.conn, err = net.Dial(protocol,
c.host+":"+strconv.Itoa(6000+c.DisplayNumber))
} else {
+ c.host = ""
c.conn, err = net.Dial("unix", "/tmp/.X11-unix/X"+c.display)
}