From f6dad8d0fae25b5d88ad036b841fea10b7296ccb Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Thu, 3 Jan 2019 13:32:13 +0100 Subject: nametransform: simplify WriteDirIV to WriteDirIVAt Un-spaghettify the function and let the callers open the directory. --- tests/test_helpers/helpers.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/test_helpers/helpers.go b/tests/test_helpers/helpers.go index c6a4d6e..9ff29a8 100644 --- a/tests/test_helpers/helpers.go +++ b/tests/test_helpers/helpers.go @@ -18,6 +18,7 @@ import ( "github.com/rfjakob/gocryptfs/internal/ctlsock" "github.com/rfjakob/gocryptfs/internal/nametransform" + "github.com/rfjakob/gocryptfs/internal/syscallcompat" ) // TmpDir will be created inside this directory, set in init() to @@ -112,7 +113,12 @@ func ResetTmpDir(createDirIV bool) { panic(err) } if createDirIV { - err = nametransform.WriteDirIV(-1, DefaultCipherDir) + // Open cipherdir (following symlinks) + dirfd, err := syscall.Open(DefaultCipherDir, syscall.O_RDONLY|syscall.O_DIRECTORY|syscallcompat.O_PATH, 0) + if err == nil { + err = nametransform.WriteDirIVAt(dirfd) + syscall.Close(dirfd) + } if err != nil { panic(err) } -- cgit v1.2.3