From 9f8d0d8e5734e3771b52c8a8784ef5a76b0f9ca8 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Thu, 1 Feb 2018 23:46:02 +0100 Subject: 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 --- internal/nametransform/diriv.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'internal/nametransform') 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 -- cgit v1.2.3