aboutsummaryrefslogtreecommitdiff
path: root/src/syscall/syscall_unix_test.go
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2021-04-13 11:01:13 +0200
committerTobias Klauser <tobias.klauser@gmail.com>2021-04-14 05:49:15 +0000
commit58fdac04e4534e53fd9ca7df0455efb4f1ddb82b (patch)
tree53511cf11e1d4b4cce85d72ae8b2ff32ac978835 /src/syscall/syscall_unix_test.go
parent6d8ba77896d05720e1cb1728c27db60926e672b5 (diff)
downloadgo-58fdac04e4534e53fd9ca7df0455efb4f1ddb82b.tar.xz
syscall: don't defer close raw Socketpair fds in tests
The raw fds are successively wrapped using os.NewFile and will be closed by (*os.File).Close. Avoids a double close, in the worst case closing an unrelated fd. Change-Id: I86aabe5ed865eff43d264ddae1fb07c935868e97 Reviewed-on: https://go-review.googlesource.com/c/go/+/309353 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/syscall/syscall_unix_test.go')
-rw-r--r--src/syscall/syscall_unix_test.go2
1 files changed, 0 insertions, 2 deletions
diff --git a/src/syscall/syscall_unix_test.go b/src/syscall/syscall_unix_test.go
index ce56c21ff2..af0bc856ee 100644
--- a/src/syscall/syscall_unix_test.go
+++ b/src/syscall/syscall_unix_test.go
@@ -159,8 +159,6 @@ func TestPassFD(t *testing.T) {
if err != nil {
t.Fatalf("Socketpair: %v", err)
}
- defer syscall.Close(fds[0])
- defer syscall.Close(fds[1])
writeFile := os.NewFile(uintptr(fds[0]), "child-writes")
readFile := os.NewFile(uintptr(fds[1]), "parent-reads")
defer writeFile.Close()