Commit f626696d authored by Russ Cox's avatar Russ Cox

net: fix build on old Linux kernels

Thanks to Mike Beller for identifying the problem.

Fixes #1442.

R=bradfitz, bradfitzgo
CC=golang-dev
https://golang.org/cl/4102042
parent 0e1d941e
......@@ -25,7 +25,7 @@ func runEcho(fd io.ReadWriter, done chan<- int) {
for {
n, err := fd.Read(buf[0:])
if err != nil || n == 0 {
if err != nil || n == 0 || string(buf[:n]) == "END" {
break
}
fd.Write(buf[0:n])
......@@ -79,6 +79,13 @@ func connect(t *testing.T, network, addr string, isEmpty bool) {
if n != len(b) || err1 != nil {
t.Fatalf("fd.Read() = %d, %v (want %d, nil)", n, err1, len(b))
}
// Send explicit ending for unixpacket.
// Older Linux kernels do stop reads on close.
if network == "unixpacket" {
fd.Write([]byte("END"))
}
fd.Close()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment