Skip to content
This repository has been archived by the owner on Mar 9, 2019. It is now read-only.

Commit

Permalink
Wait to clear db.path until just before db.close returns.
Browse files Browse the repository at this point in the history
The Windows version of funlock needs the db.path to delete the
corresponding .lock file.
  • Loading branch information
ChrisHines committed Apr 7, 2016
1 parent 831b652 commit 5816124
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -414,6 +413,7 @@ func (db *DB) close() error {
db.file = nil
}

db.path = ""
return nil
}

Expand Down

0 comments on commit 5816124

Please sign in to comment.