summaryrefslogtreecommitdiff
path: root/vendor/github.com/ncruces/go-sqlite3/vfs/shm_ofd.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/ncruces/go-sqlite3/vfs/shm_ofd.go')
-rw-r--r--vendor/github.com/ncruces/go-sqlite3/vfs/shm_ofd.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/shm_ofd.go b/vendor/github.com/ncruces/go-sqlite3/vfs/shm_ofd.go
index d335a85fc..dd3611193 100644
--- a/vendor/github.com/ncruces/go-sqlite3/vfs/shm_ofd.go
+++ b/vendor/github.com/ncruces/go-sqlite3/vfs/shm_ofd.go
@@ -110,7 +110,12 @@ func (s *vfsShm) shmMap(ctx context.Context, mod api.Module, id, size int32, ext
func (s *vfsShm) shmLock(offset, n int32, flags _ShmFlag) _ErrorCode {
// Argument check.
- if n <= 0 || offset < 0 || offset+n > _SHM_NLOCK {
+ switch {
+ case n <= 0:
+ panic(util.AssertErr())
+ case offset < 0 || offset+n > _SHM_NLOCK:
+ panic(util.AssertErr())
+ case n != 1 && flags&_SHM_EXCLUSIVE == 0:
panic(util.AssertErr())
}
switch flags {
@@ -123,9 +128,6 @@ func (s *vfsShm) shmLock(offset, n int32, flags _ShmFlag) _ErrorCode {
default:
panic(util.AssertErr())
}
- if n != 1 && flags&_SHM_EXCLUSIVE == 0 {
- panic(util.AssertErr())
- }
var timeout time.Duration
if s.blocking {