summaryrefslogtreecommitdiff
path: root/vendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2024-06-22 09:59:29 +0000
committerLibravatar GitHub <noreply@github.com>2024-06-22 11:59:29 +0200
commit15e0bf6e5a57e60edf4a576db2dcb9bc07a163bf (patch)
tree1e12f30d28c8a9640121b16b526a817486ed17f2 /vendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go
parentupdate remaining gruf libraries relying on linkname (#3028) (diff)
downloadgotosocial-15e0bf6e5a57e60edf4a576db2dcb9bc07a163bf.tar.xz
[chore] update github.com/ncruces/go-sqlite3 -> v0.16.3 (#3029)
Diffstat (limited to 'vendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go')
-rw-r--r--vendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go b/vendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go
index 48ac5c9c9..9f3c99daf 100644
--- a/vendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go
+++ b/vendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go
@@ -29,5 +29,12 @@ func osReadLock(file *os.File, _ /*start*/, _ /*len*/ int64, _ /*timeout*/ time.
}
func osWriteLock(file *os.File, _ /*start*/, _ /*len*/ int64, _ /*timeout*/ time.Duration) _ErrorCode {
- return osLock(file, unix.LOCK_EX|unix.LOCK_NB, _IOERR_LOCK)
+ rc := osLock(file, unix.LOCK_EX|unix.LOCK_NB, _IOERR_LOCK)
+ if rc == _BUSY {
+ // The documentation states the lock is upgraded by releasing the previous lock,
+ // then acquiring the new lock.
+ // This is a race, so return BUSY_SNAPSHOT to ensure the transaction is aborted.
+ return _BUSY_SNAPSHOT
+ }
+ return rc
}