diff options
author | Sebastian Lackner | 2017-11-28 00:54:38 +0100 |
---|---|---|
committer | rfjakob | 2017-11-28 09:28:06 +0100 |
commit | 5a56810603ff9608c98d71cbfb8a6454da4c2261 (patch) | |
tree | 1011a0161c3df932cfd072e3c7e19d72e983724d /internal/syscallcompat/sys_linux.go | |
parent | 295c4c2b852c83ff265466cdeba3cbbc05820e4a (diff) |
fusefrontend: Use the Symlinkat syscall for longname handling
Diffstat (limited to 'internal/syscallcompat/sys_linux.go')
-rw-r--r-- | internal/syscallcompat/sys_linux.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/syscallcompat/sys_linux.go b/internal/syscallcompat/sys_linux.go index 8a64a81..277015e 100644 --- a/internal/syscallcompat/sys_linux.go +++ b/internal/syscallcompat/sys_linux.go @@ -4,6 +4,7 @@ package syscallcompat import ( "sync" "syscall" + "unsafe" "github.com/rfjakob/gocryptfs/internal/tlog" ) @@ -73,3 +74,23 @@ func Dup3(oldfd int, newfd int, flags int) (err error) { func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { return syscall.Fchownat(dirfd, path, uid, gid, flags) } + +// Symlinkat syscall. Unfortunately this function is not exported directly, so +// manually call it by using the corresponding syscall number. +func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = syscall.BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = syscall.BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := syscall.Syscall(syscall.SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + if e1 != 0 { + err = e1 + } + return +} |