unix: fix EINTR check in TestPselect
err == EINTR needs to be checked before err != nil for the interrupted
syscall to be retried properly.
Follow-up for CL 207284
Updates golang/go#35555
Change-Id: I76d569058b7985ec51f07909d86807a8b4911772
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207292
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/unix/syscall_linux_test.go b/unix/syscall_linux_test.go
index 99a0f65..01a1028 100644
--- a/unix/syscall_linux_test.go
+++ b/unix/syscall_linux_test.go
@@ -289,11 +289,11 @@
func TestPselect(t *testing.T) {
for {
_, err := unix.Pselect(0, nil, nil, nil, &unix.Timespec{Sec: 0, Nsec: 0}, nil)
- if err != nil {
- t.Fatalf("Pselect: %v", err)
- } else if err == unix.EINTR {
+ if err == unix.EINTR {
t.Logf("Pselect interrupted")
continue
+ } else if err != nil {
+ t.Fatalf("Pselect: %v", err)
}
break
}