From 5da292828c3a58254560bb47d700186ff8c3ca9c Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Wed, 8 Jun 2016 00:17:18 +0200 Subject: fusefrontend: fix chown on dangling symlinks We (actually, go-fuse) used to call Chown() instead of Lchown() which meant that the operation would fail on dangling symlinks. Fix this by calling os.Lchown() ourself. Also add a test case for this. --- internal/fusefrontend/fs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'internal') diff --git a/internal/fusefrontend/fs.go b/internal/fusefrontend/fs.go index 988a41a..c216c86 100644 --- a/internal/fusefrontend/fs.go +++ b/internal/fusefrontend/fs.go @@ -165,11 +165,11 @@ func (fs *FS) Chown(path string, uid uint32, gid uint32, context *fuse.Context) if fs.isFiltered(path) { return fuse.EPERM } - cPath, err := fs.encryptPath(path) + cPath, err := fs.getBackingPath(path) if err != nil { return fuse.ToStatus(err) } - return fs.FileSystem.Chown(cPath, uid, gid, context) + return fuse.ToStatus(os.Lchown(cPath, int(uid), int(gid))) } func (fs *FS) Mknod(path string, mode uint32, dev uint32, context *fuse.Context) (code fuse.Status) { -- cgit v1.2.3