1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Bug fix in the sqliteOsLock() and sqliteOsUnlock() routines of POSIX.

Version 2.1.5. (CVS 325)

FossilOrigin-Name: 669454060867593290c1ce8c45bd87d011976289
This commit is contained in:
drh
2001-12-06 13:24:14 +00:00
parent 7df884e0d6
commit 2cf65aad6c
5 changed files with 22 additions and 12 deletions

View File

@@ -594,14 +594,17 @@ int sqliteOsLock(OsFile id, int wrlock){
id.pLock->cnt++;
}
}
sqliteOsLeaveMutex();
if( rc==SQLITE_OK && needSysLock ){
struct flock lock;
lock.l_type = wrlock ? F_WRLCK : F_RDLCK;
lock.l_whence = SEEK_SET;
lock.l_start = lock.l_len = 0L;
rc = fcntl(id.fd, F_SETLK, &lock)==0 ? SQLITE_OK : SQLITE_BUSY;
if( rc ){
id.pLock->cnt = 0;
}
}
sqliteOsLeaveMutex();
return rc;
#endif
#if OS_WIN
@@ -631,7 +634,6 @@ int sqliteOsUnlock(OsFile id){
rc = SQLITE_OK;
needSysUnlock = 0;
}
sqliteOsLeaveMutex();
if( needSysUnlock ){
struct flock lock;
lock.l_type = F_UNLCK;
@@ -639,6 +641,7 @@ int sqliteOsUnlock(OsFile id){
lock.l_start = lock.l_len = 0L;
rc = fcntl(id.fd, F_SETLK, &lock)==0 ? SQLITE_OK : SQLITE_IOERR;
}
sqliteOsLeaveMutex();
return rc;
#endif
#if OS_WIN