Skip to content

Commit

Permalink
Fix unix:0.0 connections
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
andydotxyz authored and BurntSushi committed Oct 8, 2020
1 parent 20f126e commit 5f9e7b3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 5f9e7b3

Please sign in to comment.