From e7ba3c61f1055d740539d608cc521d816d07cddd Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Wed, 9 Sep 2015 19:32:59 +0200 Subject: Fix File.GettAttr() size reporting The too-large reported value broke mmap (applications saw appended zero bytes) Also * Add locking for all fd operations * Add "--debug" command line switch --- pathfs_frontend/fs.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'pathfs_frontend/fs.go') diff --git a/pathfs_frontend/fs.go b/pathfs_frontend/fs.go index 0c1d879..1e4a1f3 100644 --- a/pathfs_frontend/fs.go +++ b/pathfs_frontend/fs.go @@ -112,8 +112,17 @@ func (fs *FS) Utimens(path string, Atime *time.Time, Mtime *time.Time, context * return fs.FileSystem.Utimens(fs.EncryptPath(path), Atime, Mtime, context) } -func (fs *FS) Readlink(name string, context *fuse.Context) (out string, code fuse.Status) { - return fs.FileSystem.Readlink(fs.EncryptPath(name), context) +func (fs *FS) Readlink(name string, context *fuse.Context) (out string, status fuse.Status) { + dst, status := fs.FileSystem.Readlink(fs.EncryptPath(name), context) + if status != fuse.OK { + return "", status + } + dstPlain, err := fs.DecryptPath(dst) + if err != nil { + cryptfs.Warn.Printf("Failed decrypting symlink: %s\n", err.Error()) + return "", fuse.EIO + } + return dstPlain, status } func (fs *FS) Mknod(name string, mode uint32, dev uint32, context *fuse.Context) (code fuse.Status) { -- cgit v1.2.3