1
0
mirror of https://github.com/golang/go synced 2024-11-18 10:14:45 -07:00

syscall: fix TestSCMCredentials

Fixes #10703.

Change-Id: I55c0f07625a0847fb27defa9891af6db6eb21f82
Reviewed-on: https://go-review.googlesource.com/9714
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Mikio Hara 2015-05-06 00:02:30 +09:00
parent 9f5d0bff41
commit fe3446bda2

View File

@ -56,7 +56,13 @@ func TestSCMCredentials(t *testing.T) {
ucred.Gid = 0
oob := syscall.UnixCredentials(&ucred)
_, _, err := cli.(*net.UnixConn).WriteMsgUnix(nil, oob, nil)
if err.(*net.OpError).Err != syscall.EPERM {
if op, ok := err.(*net.OpError); ok {
err = op.Err
}
if sys, ok := err.(*os.SyscallError); ok {
err = sys.Err
}
if err != syscall.EPERM {
t.Fatalf("WriteMsgUnix failed with %v, want EPERM", err)
}
}