fusefrontend: print file hexdump on header error
This should help debugging https://github.com/rfjakob/gocryptfs/issues/363 , but does no harm in normal operation as it only prints ciphertext to the log.
This commit is contained in:
parent
b3c88f573f
commit
43265940fa
@ -4,6 +4,7 @@ package fusefrontend
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
@ -158,7 +159,12 @@ func (f *File) doRead(dst []byte, off uint64, length uint64) ([]byte, fuse.Statu
|
||||
// Empty file
|
||||
return nil, fuse.OK
|
||||
}
|
||||
tlog.Warn.Printf("doRead %d: corrupt header: %v", f.qIno.Ino, err)
|
||||
buf := make([]byte, 100)
|
||||
n, _ := f.fd.ReadAt(buf, 0)
|
||||
buf = buf[:n]
|
||||
hexdump := hex.EncodeToString(buf)
|
||||
tlog.Warn.Printf("doRead %d: corrupt header: %v\nFile hexdump (%d bytes): %s",
|
||||
f.qIno.Ino, err, n, hexdump)
|
||||
return nil, fuse.EIO
|
||||
}
|
||||
// Save into the file table
|
||||
|
Loading…
Reference in New Issue
Block a user