mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Bug fix: sqlite_exec() would sometimes return SQLITE_PROTOCOL when it
should have returned SQLITE_BUSY. There was also a deadlock that the previous bug was masking. (CVS 322) FossilOrigin-Name: 585ed5ebf1c1afc8ae1d569b121208018d8ecd49
This commit is contained in:
15
src/pager.c
15
src/pager.c
@@ -18,7 +18,7 @@
|
||||
** file simultaneously, or one process from reading the database while
|
||||
** another is writing.
|
||||
**
|
||||
** @(#) $Id: pager.c,v 1.31 2001/11/22 00:01:27 drh Exp $
|
||||
** @(#) $Id: pager.c,v 1.32 2001/12/05 00:21:20 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include "pager.h"
|
||||
@@ -955,13 +955,20 @@ int sqlitepager_write(void *pData){
|
||||
}
|
||||
sqliteOsUnlock(pPager->fd);
|
||||
if( sqliteOsLock(pPager->fd, 1)!=SQLITE_OK ){
|
||||
sqliteOsUnlock(pPager->fd);
|
||||
rc = sqliteOsLock(pPager->fd, 0);
|
||||
sqliteFree(pPager->aInJournal);
|
||||
sqliteOsClose(pPager->jfd);
|
||||
sqliteOsDelete(pPager->zJournal);
|
||||
pPager->journalOpen = 0;
|
||||
pPager->state = SQLITE_UNLOCK;
|
||||
pPager->errMask |= PAGER_ERR_LOCK;
|
||||
return SQLITE_PROTOCOL;
|
||||
if( rc ){
|
||||
pPager->state = SQLITE_UNLOCK;
|
||||
pPager->errMask |= PAGER_ERR_LOCK;
|
||||
return SQLITE_PROTOCOL;
|
||||
}else{
|
||||
pPager->state = SQLITE_READLOCK;
|
||||
return SQLITE_BUSY;
|
||||
}
|
||||
}
|
||||
pPager->state = SQLITE_WRITELOCK;
|
||||
sqlitepager_pagecount(pPager);
|
||||
|
Reference in New Issue
Block a user