summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/sys/unix/syscall_linux_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/sys/unix/syscall_linux_test.go')
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_linux_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_test.go b/vendor/golang.org/x/sys/unix/syscall_linux_test.go
index e42b4ee68..377023130 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux_test.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux_test.go
@@ -15,6 +15,32 @@ import (
"golang.org/x/sys/unix"
)
+func TestFchmodat(t *testing.T) {
+ defer chtmpdir(t)()
+
+ touch(t, "file1")
+ os.Symlink("file1", "symlink1")
+
+ err := unix.Fchmodat(unix.AT_FDCWD, "symlink1", 0444, 0)
+ if err != nil {
+ t.Fatalf("Fchmodat: unexpected error: %v", err)
+ }
+
+ fi, err := os.Stat("file1")
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if fi.Mode() != 0444 {
+ t.Errorf("Fchmodat: failed to change mode: expected %v, got %v", 0444, fi.Mode())
+ }
+
+ err = unix.Fchmodat(unix.AT_FDCWD, "symlink1", 0444, unix.AT_SYMLINK_NOFOLLOW)
+ if err != unix.EOPNOTSUPP {
+ t.Fatalf("Fchmodat: unexpected error: %v, expected EOPNOTSUPP", err)
+ }
+}
+
func TestIoctlGetInt(t *testing.T) {
f, err := os.Open("/dev/random")
if err != nil {