aboutsummaryrefslogtreecommitdiff
path: root/internal/syscallcompat/sys_linux.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-12-03 17:53:14 +0100
committerJakob Unterwurzacher2017-12-03 19:32:59 +0100
commite33593d30d9dee6fd6b0e7c0d01832e478815d88 (patch)
tree5070656829a7215bd4fe01404f208798cd073a2b /internal/syscallcompat/sys_linux.go
parent441e796e7034977c15dc9402a880ef4061b471a7 (diff)
syscallcompat: add Fstatat + emulation + test
Fstatat has recently been added to x/sys/unix. Make it available for use in gocryptfs.
Diffstat (limited to 'internal/syscallcompat/sys_linux.go')
-rw-r--r--internal/syscallcompat/sys_linux.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/syscallcompat/sys_linux.go b/internal/syscallcompat/sys_linux.go
index 0e03143..fb8d8b3 100644
--- a/internal/syscallcompat/sys_linux.go
+++ b/internal/syscallcompat/sys_linux.go
@@ -105,3 +105,13 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
func Mkdirat(dirfd int, path string, mode uint32) (err error) {
return syscall.Mkdirat(dirfd, path, mode)
}
+
+// Fstatat syscall.
+func Fstatat(dirfd int, path string, stat *unix.Stat_t, flags int) (err error) {
+ // Why would we ever want to call this without AT_SYMLINK_NOFOLLOW?
+ if flags&unix.AT_SYMLINK_NOFOLLOW == 0 {
+ tlog.Warn.Printf("Fstatat: adding missing AT_SYMLINK_NOFOLLOW flag")
+ flags |= unix.AT_SYMLINK_NOFOLLOW
+ }
+ return unix.Fstatat(dirfd, path, stat, flags)
+}