mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-30 11:32:25 -05:00
[chore] Upgrade ncruces/go-sqlite3 to v0.18.1 (#3253)
Contains a fix for locking behaviour on the BSDs.
This commit is contained in:
parent
cd93a5baf3
commit
1e0c858a05
5 changed files with 29 additions and 5 deletions
12
vendor/github.com/ncruces/go-sqlite3/vfs/shm_bsd.go
generated
vendored
12
vendor/github.com/ncruces/go-sqlite3/vfs/shm_bsd.go
generated
vendored
|
|
@ -121,8 +121,8 @@ func (s *vfsShm) shmOpen() (rc _ErrorCode) {
|
|||
// Find a shared file, increase the reference count.
|
||||
for _, g := range vfsShmFiles {
|
||||
if g != nil && os.SameFile(fi, g.info) {
|
||||
g.refs++
|
||||
s.vfsShmFile = g
|
||||
g.refs++
|
||||
return _OK
|
||||
}
|
||||
}
|
||||
|
|
@ -207,15 +207,22 @@ func (s *vfsShm) shmLock(offset, n int32, flags _ShmFlag) _ErrorCode {
|
|||
case flags&_SHM_UNLOCK != 0:
|
||||
for i := offset; i < offset+n; i++ {
|
||||
if s.lock[i] {
|
||||
if s.vfsShmFile.lock[i] == 0 {
|
||||
panic(util.AssertErr())
|
||||
}
|
||||
if s.vfsShmFile.lock[i] <= 0 {
|
||||
s.vfsShmFile.lock[i] = 0
|
||||
} else {
|
||||
s.vfsShmFile.lock[i]--
|
||||
}
|
||||
s.lock[i] = false
|
||||
}
|
||||
}
|
||||
case flags&_SHM_SHARED != 0:
|
||||
for i := offset; i < offset+n; i++ {
|
||||
if s.lock[i] {
|
||||
panic(util.AssertErr())
|
||||
}
|
||||
if s.vfsShmFile.lock[i] < 0 {
|
||||
return _BUSY
|
||||
}
|
||||
|
|
@ -226,6 +233,9 @@ func (s *vfsShm) shmLock(offset, n int32, flags _ShmFlag) _ErrorCode {
|
|||
}
|
||||
case flags&_SHM_EXCLUSIVE != 0:
|
||||
for i := offset; i < offset+n; i++ {
|
||||
if s.lock[i] {
|
||||
panic(util.AssertErr())
|
||||
}
|
||||
if s.vfsShmFile.lock[i] != 0 {
|
||||
return _BUSY
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue