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 <dirname>'

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 '<dirname>': No such file or directory
This commit is contained in:
Sebastian Lackner 2017-11-25 02:12:02 +01:00 committed by rfjakob
parent 9f56b33e0c
commit 95870e841e

View File

@ -193,10 +193,7 @@ retry:
if err == io.EOF { if err == io.EOF {
// The directory is empty // The directory is empty
tlog.Warn.Printf("Rmdir: %q: gocryptfs.diriv is missing", cPath) tlog.Warn.Printf("Rmdir: %q: gocryptfs.diriv is missing", cPath)
err = syscall.Rmdir(cPath) return fuse.ToStatus(syscall.Rmdir(cPath))
if err != nil {
return fuse.ToStatus(err)
}
} }
if err != nil { if err != nil {
tlog.Warn.Printf("Rmdir: Readdirnames: %v", err) tlog.Warn.Printf("Rmdir: Readdirnames: %v", err)