diff options
Diffstat (limited to 'bolt_unix.go')
-rw-r--r-- | bolt_unix.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bolt_unix.go b/bolt_unix.go index 8107f4a..266222a 100644 --- a/bolt_unix.go +++ b/bolt_unix.go @@ -48,8 +48,8 @@ func funlock(f *os.File) error { func mmap(db *DB, sz int) error { // Truncate and fsync to ensure file size metadata is flushed. // https://github.com/boltdb/bolt/issues/284 - if !db.NoGrowSync { - if err := db.ops.Truncate(int64(sz)); err != nil { + if !db.NoGrowSync && !db.readOnly { + if err := db.file.Truncate(int64(sz)); err != nil { return fmt.Errorf("file resize error: %s", err) } if err := db.file.Sync(); err != nil { |