From 95870e841e395607a7df60a138f0fcc53a76f7b3 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 25 Nov 2017 02:12:02 +0100 Subject: [PATCH] fusefrontend: Skip gocryptfs.diriv handling when directory was deleted successfully Fixes https://github.com/rfjakob/gocryptfs/issues/171 Steps to reproduce: * Create a regular forward mount point * Create a new directory in the mount point * Manually delete the gocryptfs.diriv file from the corresponding ciphertext directory * Attempt to delete the directory with 'rmdir ' Although the code explicitly checks for empty directories, it will still attempt to move the non-existent gocryptfs.diriv file and fails with: rmdir: failed to remove '': No such file or directory --- internal/fusefrontend/fs_dir.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/internal/fusefrontend/fs_dir.go b/internal/fusefrontend/fs_dir.go index b144ea4..91c899e 100644 --- a/internal/fusefrontend/fs_dir.go +++ b/internal/fusefrontend/fs_dir.go @@ -193,10 +193,7 @@ retry: if err == io.EOF { // The directory is empty tlog.Warn.Printf("Rmdir: %q: gocryptfs.diriv is missing", cPath) - err = syscall.Rmdir(cPath) - if err != nil { - return fuse.ToStatus(err) - } + return fuse.ToStatus(syscall.Rmdir(cPath)) } if err != nil { tlog.Warn.Printf("Rmdir: Readdirnames: %v", err)