aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend_reverse/rfs.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-08-15 12:28:29 +0200
committerJakob Unterwurzacher2018-08-15 12:28:29 +0200
commit7a02f71fc2fc8fc104ad1538f417d1e93e73cf11 (patch)
tree663a95888a011b68f22b8292dec4e891a05e81f7 /internal/fusefrontend_reverse/rfs.go
parent8989905333f1f47d90e8874a36559c48a8f5ba50 (diff)
fusefrontend_reverse: reject excludes for the root directory ""
This is most likely a mistake by the user. Reject it.
Diffstat (limited to 'internal/fusefrontend_reverse/rfs.go')
-rw-r--r--internal/fusefrontend_reverse/rfs.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/fusefrontend_reverse/rfs.go b/internal/fusefrontend_reverse/rfs.go
index ba8810c..1ca0b28 100644
--- a/internal/fusefrontend_reverse/rfs.go
+++ b/internal/fusefrontend_reverse/rfs.go
@@ -63,6 +63,10 @@ func NewFS(args fusefrontend.Args, c *contentenc.ContentEnc, n *nametransform.Na
if clean != dirty {
tlog.Warn.Printf("-exclude: non-canonical path %q has been interpreted as %q", dirty, clean)
}
+ if clean == "" {
+ tlog.Fatal.Printf("-exclude: excluding the root dir %q makes no sense", clean)
+ os.Exit(exitcodes.ExcludeError)
+ }
cPath, err := fs.EncryptPath(clean)
if err != nil {
tlog.Fatal.Printf("-exclude: EncryptPath %q failed: %v", clean, err)
@@ -90,6 +94,11 @@ func relDir(path string) string {
// (used when -exclude is passed by the user)
func (rfs *ReverseFS) isExcluded(relPath string) bool {
for _, e := range rfs.cExclude {
+ // If the root dir is excluded, everything is excluded.
+ if e == "" {
+ return true
+ }
+ // This exact path is excluded
if e == relPath {
return true
}