diff options
author | Jakob Unterwurzacher | 2018-02-01 23:46:02 +0100 |
---|---|---|
committer | Jakob Unterwurzacher | 2018-02-01 23:50:11 +0100 |
commit | 9f8d0d8e5734e3771b52c8a8784ef5a76b0f9ca8 (patch) | |
tree | 7a09341b4bad590caa47e26ceaa8033e991a7dcf /internal/nametransform/diriv.go | |
parent | 26ba8103bf2422493a01b57b8ee53aa9b1e867f7 (diff) |
gccgo: replace syscall.NAME_MAX with unix.NAME_MAX
For some reason the syscall.NAME_MAX constant does not exist
on gccgo, and it does not hurt us to use unix.NAME_MAX instead.
https://github.com/rfjakob/gocryptfs/issues/201
Diffstat (limited to 'internal/nametransform/diriv.go')
-rw-r--r-- | internal/nametransform/diriv.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/nametransform/diriv.go b/internal/nametransform/diriv.go index 527ccce..06f029e 100644 --- a/internal/nametransform/diriv.go +++ b/internal/nametransform/diriv.go @@ -9,6 +9,8 @@ import ( "strings" "syscall" + "golang.org/x/sys/unix" + "github.com/rfjakob/gocryptfs/internal/cryptocore" "github.com/rfjakob/gocryptfs/internal/syscallcompat" "github.com/rfjakob/gocryptfs/internal/tlog" @@ -111,7 +113,7 @@ func WriteDirIV(dirfd *os.File, dir string) error { // too long. func (be *NameTransform) encryptAndHashName(name string, iv []byte) string { cName := be.EncryptName(name, iv) - if be.longNames && len(cName) > syscall.NAME_MAX { + if be.longNames && len(cName) > unix.NAME_MAX { return be.HashLongName(cName) } return cName @@ -128,7 +130,7 @@ func (be *NameTransform) EncryptPathDirIV(plainPath string, rootDir string) (str } // Reject names longer than 255 bytes. baseName := filepath.Base(plainPath) - if len(baseName) > syscall.NAME_MAX { + if len(baseName) > unix.NAME_MAX { return "", syscall.ENAMETOOLONG } // If we have the iv and the encrypted directory name in the cache, we |