aboutsummaryrefslogtreecommitdiff
path: root/cryptfs
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-09-09 19:32:59 +0200
committerJakob Unterwurzacher2015-09-09 19:32:59 +0200
commite7ba3c61f1055d740539d608cc521d816d07cddd (patch)
tree576c202f47457e2e2faad3f139efc65667cdc11e /cryptfs
parent80935a0e1b3848608bcc8e1e1497435801ac9940 (diff)
Fix File.GettAttr() size reporting
The too-large reported value broke mmap (applications saw appended zero bytes) Also * Add locking for all fd operations * Add "--debug" command line switch
Diffstat (limited to 'cryptfs')
-rw-r--r--cryptfs/log.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/cryptfs/log.go b/cryptfs/log.go
index f9c46c8..03d1e29 100644
--- a/cryptfs/log.go
+++ b/cryptfs/log.go
@@ -2,18 +2,28 @@ package cryptfs
import (
"fmt"
+ "strings"
)
type logChannel struct {
enabled bool
}
-func (l logChannel) Printf(format string, args ...interface{}) {
+func (l *logChannel) Printf(format string, args ...interface{}) {
if l.enabled == true {
fmt.Printf(format, args...)
}
}
+func (l *logChannel) Dump(d []byte) {
+ s := string(d)
+ fmt.Println(strings.Replace(s, "\000", "\\0", -1))
+}
+
+func (l *logChannel) Enable() {
+ l.enabled = true
+}
+
var Debug = logChannel{false}
var Warn = logChannel{true}