From 653d4a619cb7b937d81deab4f20d3c8d4baa4898 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 7 Feb 2016 14:02:09 +0100 Subject: longnames part II: Rename, Unlink, Rmdir, Mknod, Mkdir + tests --- internal/fusefrontend/fs_dir.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'internal/fusefrontend/fs_dir.go') diff --git a/internal/fusefrontend/fs_dir.go b/internal/fusefrontend/fs_dir.go index f1ade25..ebf7015 100644 --- a/internal/fusefrontend/fs_dir.go +++ b/internal/fusefrontend/fs_dir.go @@ -10,6 +10,7 @@ import ( "github.com/hanwen/go-fuse/fuse" + "github.com/rfjakob/gocryptfs/internal/configfile" "github.com/rfjakob/gocryptfs/internal/cryptocore" "github.com/rfjakob/gocryptfs/internal/nametransform" "github.com/rfjakob/gocryptfs/internal/toggledlog" @@ -30,7 +31,11 @@ func (fs *FS) Mkdir(relPath string, mode uint32, context *fuse.Context) (code fu // We need write and execute permissions to create gocryptfs.diriv origMode := mode mode = mode | 0300 - + // Create .name file to store the long file name if needed + err = fs.nameTransform.WriteLongName(encPath, relPath) + if err != nil { + return fuse.ToStatus(err) + } // The new directory may take the place of an older one that is still in the cache fs.nameTransform.DirIVCache.Clear() // Create directory @@ -151,6 +156,10 @@ func (fs *FS) Rmdir(name string, context *fuse.Context) (code fuse.Status) { if err != nil { toggledlog.Warn.Printf("Rmdir: Could not clean up %s: %v", tmpName, err) } + err = nametransform.DeleteLongName(encPath) + if err != nil { + toggledlog.Warn.Printf("Rmdir: Could not delete long name file: %v", err) + } // The now-deleted directory may have been in the DirIV cache. Clear it. fs.nameTransform.DirIVCache.Clear() return fuse.OK -- cgit v1.2.3