aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend/file.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-04-03 21:19:44 +0200
committerJakob Unterwurzacher2018-04-03 21:24:48 +0200
commit4e5783591f9874e2c7336598c96ebd2c5840bd5b (patch)
tree589e9381ad3868eb1eb7dc384fdca4c18cda901b /internal/fusefrontend/file.go
parent8b443c8484f5fdcedbec2a689a7d66d2a277b26e (diff)
fsck: report skipped corrupt files
OpenDir and ListXAttr skip over corrupt entries, readFileID treats files the are too small as empty. This improves usability in the face of corruption, but hides the problem in a log message instead of putting it in the return code. Create a channel to report these corruptions to fsck so it can report them to the user. Also update the manpage and the changelog with the -fsck option. Closes https://github.com/rfjakob/gocryptfs/issues/191
Diffstat (limited to 'internal/fusefrontend/file.go')
-rw-r--r--internal/fusefrontend/file.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/internal/fusefrontend/file.go b/internal/fusefrontend/file.go
index af13170..72319e9 100644
--- a/internal/fusefrontend/file.go
+++ b/internal/fusefrontend/file.go
@@ -4,6 +4,7 @@ package fusefrontend
import (
"bytes"
+ "fmt"
"io"
"log"
"os"
@@ -99,6 +100,7 @@ func (f *file) readFileID() ([]byte, error) {
if err == io.EOF && n != 0 {
tlog.Warn.Printf("readFileID %d: incomplete file, got %d instead of %d bytes",
f.qIno.Ino, n, readLen)
+ f.fs.reportCorruptItem(fmt.Sprint(f.qIno.Ino))
}
return nil, err
}