Commit bb729a57 authored by Tobias Klauser's avatar Tobias Klauser Committed by Tobias Klauser

unix: fix TestFchmodat on Illumos

On Illumos, TestFchmodat fails with:

--- FAIL: TestFchmodat (0.00s)
        syscall_unix_test.go:502: Fchmodat: unexpected error: operation not supported on transport endpoint

Like Linux, Illumos doesn't support flags != 0 in Fchmodat, see
https://illumos.org/man/2/chmod

Adjust TestFchmodat accordingly to handle EOPNOTSUPP on Illumos.

Change-Id: Icd4564497a41c4aa962cd76604b5ca2c7575d96c
Reviewed-on: https://go-review.googlesource.com/101775
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 64160521
......@@ -492,16 +492,18 @@ func TestFchmodat(t *testing.T) {
}
mode = os.FileMode(0644)
didChmodSymlink := true
err = unix.Fchmodat(unix.AT_FDCWD, "symlink1", uint32(mode), unix.AT_SYMLINK_NOFOLLOW)
if err != nil {
if runtime.GOOS == "linux" && err == unix.EOPNOTSUPP {
// Linux doesn't support flags != 0
if (runtime.GOOS == "linux" || runtime.GOOS == "solaris") && err == unix.EOPNOTSUPP {
// Linux and Illumos don't support flags != 0
didChmodSymlink = false
} else {
t.Fatalf("Fchmodat: unexpected error: %v", err)
}
}
if runtime.GOOS == "linux" {
if !didChmodSymlink {
// Didn't change mode of the symlink. On Linux, the permissions
// of a symbolic link are always 0777 according to symlink(7)
mode = os.FileMode(0777)
......
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