diff --git a/tests/cli/cli_test.go b/tests/cli/cli_test.go index d63625b..c433e92 100644 --- a/tests/cli/cli_test.go +++ b/tests/cli/cli_test.go @@ -982,7 +982,7 @@ func TestMountCreat(t *testing.T) { for i := 0; i < concurrency; i++ { go func(i int) { path := fmt.Sprintf("%s/%d", mnt, i) - fd, err := syscall.Creat(path, 0600) + fd, err := syscall.Open(path, syscall.O_CREAT|syscall.O_WRONLY|syscall.O_TRUNC, 0600) syscall.Close(fd) if err != nil { t.Errorf("Creat %q: %v", path, err) diff --git a/tests/defaults/main_test.go b/tests/defaults/main_test.go index 5310003..43019ba 100644 --- a/tests/defaults/main_test.go +++ b/tests/defaults/main_test.go @@ -401,7 +401,7 @@ func TestMaxlen(t *testing.T) { func TestFsync(t *testing.T) { fileName := test_helpers.DefaultPlainDir + "/" + t.Name() + ".file" - fileFD, err := syscall.Creat(fileName, 0600) + fileFD, err := syscall.Open(fileName, syscall.O_CREAT|syscall.O_WRONLY|syscall.O_TRUNC, 0600) if err != nil { t.Fatal(err) } @@ -447,7 +447,7 @@ func TestForceOwner(t *testing.T) { // In the answer to a FUSE CREATE, gocryptfs sends file information including // the owner. This is cached by the kernel and will be used for the next // stat() call. - fd, err := syscall.Creat(foo, 0666) + fd, err := syscall.Open(foo, syscall.O_CREAT|syscall.O_WRONLY|syscall.O_EXCL, 0666) if err != nil { t.Fatal(err) } diff --git a/tests/matrix/concurrency_test.go b/tests/matrix/concurrency_test.go index d133c45..d824316 100644 --- a/tests/matrix/concurrency_test.go +++ b/tests/matrix/concurrency_test.go @@ -144,7 +144,7 @@ func TestInoReuse(t *testing.T) { wg.Add(1) go func() { for i := 0; i < 1000; i++ { - fd, err := syscall.Creat(fn, 0600) + fd, err := syscall.Open(fn, syscall.O_CREAT|syscall.O_WRONLY|syscall.O_TRUNC, 0600) if err == syscall.EISDIR { continue } diff --git a/tests/plaintextnames/plaintextnames_test.go b/tests/plaintextnames/plaintextnames_test.go index c6d6145..f2dc7e7 100644 --- a/tests/plaintextnames/plaintextnames_test.go +++ b/tests/plaintextnames/plaintextnames_test.go @@ -116,7 +116,7 @@ func TestInoReuseEvil(t *testing.T) { } // create a new file that will likely get the same inode number pPath2 := pPath + "2" - fd, err := syscall.Creat(pPath2, 0600) + fd, err := syscall.Open(pPath2, syscall.O_CREAT|syscall.O_WRONLY|syscall.O_TRUNC, 0600) if err != nil { t.Fatal(err) } diff --git a/tests/root_test/root_test.go b/tests/root_test/root_test.go index 3794e69..f0f5a1b 100644 --- a/tests/root_test/root_test.go +++ b/tests/root_test/root_test.go @@ -120,7 +120,7 @@ func writeTillFull(t *testing.T, path string) (int, syscall.Errno) { runtime.LockOSThread() defer runtime.UnlockOSThread() - fd, err := syscall.Creat(path, 0600) + fd, err := syscall.Open(path, syscall.O_CREAT|syscall.O_WRONLY|syscall.O_TRUNC, 0600) if err != nil { return 0, err.(syscall.Errno) } diff --git a/tests/sharedstorage/sharedstorage_test.go b/tests/sharedstorage/sharedstorage_test.go index a08deed..88f3304 100644 --- a/tests/sharedstorage/sharedstorage_test.go +++ b/tests/sharedstorage/sharedstorage_test.go @@ -77,7 +77,7 @@ func TestDirUnlink(t *testing.T) { if err := unix.Rmdir(tc.mnt2 + "/foo"); err != nil { t.Fatal(err) } - if fd, err := unix.Creat(tc.mnt2+"/foo", 0600); err != nil { + if fd, err := unix.Open(tc.mnt2+"/foo", unix.O_CREAT|unix.O_WRONLY|unix.O_TRUNC, 0600); err != nil { t.Fatal(err) } else { unix.Close(fd) @@ -104,7 +104,7 @@ func TestStaleHardlinks(t *testing.T) { defer tc.cleanup() link0 := tc.mnt1 + "/link0" - if fd, err := unix.Creat(link0, 0600); err != nil { + if fd, err := unix.Open(link0, unix.O_CREAT|unix.O_WRONLY|unix.O_TRUNC, 0600); err != nil { t.Fatal(err) } else { unix.Close(fd)