aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2016-04-07 08:34:38 -0600
committerBen Johnson <benbjohnson@yahoo.com>2016-04-07 08:34:38 -0600
commit144418e1475d8bf7abbdc48583500f1a20c62ea7 (patch)
tree9c502a469edfc3254c37b34cdfbbafaf68303d65
parentMerge pull request #546 from josephspurrier/master (diff)
parentWait to clear db.path until just before db.close returns. (diff)
downloaddedo-144418e1475d8bf7abbdc48583500f1a20c62ea7.tar.gz
dedo-144418e1475d8bf7abbdc48583500f1a20c62ea7.tar.xz
Merge pull request #550 from ChrisHines/windows-remove-lock
Delay clearing db.path until just before db.close returns.
-rw-r--r--db.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/db.go b/db.go
index 501d36a..8503665 100644
--- a/db.go
+++ b/db.go
@@ -94,7 +94,7 @@ type DB struct {
path string
file *os.File
lockfile *os.File // windows only
- dataref []byte // mmap'ed readonly, write throws SEGV
+ dataref []byte // mmap'ed readonly, write throws SEGV
data *[maxMapSize]byte
datasz int
filesz int // current on disk file size
@@ -383,11 +383,10 @@ func (db *DB) close() error {
if !db.opened {
return nil
}
-
+
db.opened = false
db.freelist = nil
- db.path = ""
// Clear ops.
db.ops.writeAt = nil
@@ -414,6 +413,7 @@ func (db *DB) close() error {
db.file = nil
}
+ db.path = ""
return nil
}