mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-02 15:17:31 -04:00
unix: fix event port panic after close
Fixes golang/go#54363 Change-Id: I38813aefaf58ef91605e0a6e3e6622c8a39d6a8d Reviewed-on: https://go-review.googlesource.com/c/sys/+/422338 Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
committed by
Gopher Robot
parent
7ac13a9a92
commit
27713097b9
@@ -9,7 +9,6 @@ package unix_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
@@ -49,7 +48,7 @@ func TestSysconf(t *testing.T) {
|
||||
// Event Ports
|
||||
|
||||
func TestBasicEventPort(t *testing.T) {
|
||||
tmpfile, err := ioutil.TempFile("", "eventport")
|
||||
tmpfile, err := os.CreateTemp("", "eventport")
|
||||
if err != nil {
|
||||
t.Fatalf("unable to create a tempfile: %v", err)
|
||||
}
|
||||
@@ -162,7 +161,7 @@ func TestEventPortFds(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEventPortErrors(t *testing.T) {
|
||||
tmpfile, err := ioutil.TempFile("", "eventport")
|
||||
tmpfile, err := os.CreateTemp("", "eventport")
|
||||
if err != nil {
|
||||
t.Errorf("unable to create a tempfile: %v", err)
|
||||
}
|
||||
@@ -189,7 +188,7 @@ func TestEventPortErrors(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Errorf("unexpected success dissociating unassociated fd")
|
||||
}
|
||||
events := make([]unix.PortEvent, 4, 4)
|
||||
events := make([]unix.PortEvent, 4)
|
||||
_, err = port.Get(events, 5, nil)
|
||||
if err == nil {
|
||||
t.Errorf("unexpected success calling Get with min greater than len of slice")
|
||||
@@ -248,7 +247,7 @@ func TestPortEventSlices(t *testing.T) {
|
||||
}
|
||||
// Create, associate, and delete 6 files
|
||||
for i := 0; i < 6; i++ {
|
||||
tmpfile, err := ioutil.TempFile("", "eventport")
|
||||
tmpfile, err := os.CreateTemp("", "eventport")
|
||||
if err != nil {
|
||||
t.Fatalf("unable to create tempfile: %v", err)
|
||||
}
|
||||
@@ -275,7 +274,7 @@ func TestPortEventSlices(t *testing.T) {
|
||||
}
|
||||
timeout := new(unix.Timespec)
|
||||
timeout.Nsec = 1
|
||||
events := make([]unix.PortEvent, 4, 4)
|
||||
events := make([]unix.PortEvent, 4)
|
||||
n, err = port.Get(events, 3, timeout)
|
||||
if err != nil {
|
||||
t.Errorf("Get failed: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user