1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

If a hot-journal file is detected but the application does not have the required read/write permissions, return SQLITE_CANTOPEN. Prior to this change, SQLITE_BUSY was returned. Ticket #3457. (CVS 5849)

FossilOrigin-Name: dc5308c7629abe6a3bad21489c8e97087c264e5a
This commit is contained in:
danielk1977
2008-10-29 07:01:56 +00:00
parent d1370b6d92
commit 281d8bd3ac
4 changed files with 90 additions and 16 deletions

View File

@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.499 2008/10/22 16:26:48 shane Exp $
** @(#) $Id: pager.c,v 1.500 2008/10/29 07:01:57 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@@ -2640,8 +2640,8 @@ static int pagerSharedLock(Pager *pPager){
assert( !pPager->tempFile );
rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &fout);
assert( rc!=SQLITE_OK || pPager->jfd->pMethods );
if( fout&SQLITE_OPEN_READONLY ){
rc = SQLITE_BUSY;
if( rc==SQLITE_OK && fout&SQLITE_OPEN_READONLY ){
rc = SQLITE_CANTOPEN;
sqlite3OsClose(pPager->jfd);
}
}else{
@@ -2652,11 +2652,6 @@ static int pagerSharedLock(Pager *pPager){
}
}
if( rc!=SQLITE_OK ){
if( rc!=SQLITE_NOMEM && rc!=SQLITE_IOERR_UNLOCK
&& rc!=SQLITE_IOERR_NOMEM
){
rc = SQLITE_BUSY;
}
goto failed;
}
pPager->journalOpen = 1;