In the Windows VFS, when trying to open a database file read/write, if it
fails check to see if the file exists and is read-only and immediately fall back to a read-only open attempt, rather than running the AV retry loop. FossilOrigin-Name: 5d03c738e93d36815248991d9ed3d62297ba1bb966e602e7874410076c144f43
This commit is contained in:
parent
b40d9eea50
commit
0e97e9a4c2
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C In\sthe\sWindows\sVFS,\sdo\snot\semit\san\sSQLITE_CANTOPEN\serror\slog\smessage\swhen\nfalling\sback\sfrom\sSQLITE_OPEN_READWRITE\sto\sSQLITE_OPEN_READONLY.\s\sWait\suntil\nthe\sopen\sfails\scompletely.
|
||||
D 2017-09-21T20:03:17.227
|
||||
C In\sthe\sWindows\sVFS,\swhen\strying\sto\sopen\sa\sdatabase\sfile\sread/write,\sif\sit\nfails\scheck\sto\ssee\sif\sthe\sfile\sexists\sand\sis\sread-only\sand\simmediately\sfall\nback\sto\sa\sread-only\sopen\sattempt,\srather\sthan\srunning\sthe\sAV\sretry\sloop.
|
||||
D 2017-09-21T20:43:48.651
|
||||
F Makefile.in 4bc36d913c2e3e2d326d588d72f618ac9788b2fd4b7efda61102611a6495c3ff
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 6033b51b6aea702ea059f6ab2d47b1d3cef648695f787247dd4fb395fe60673f
|
||||
@ -443,7 +443,7 @@ F src/os.h 8e976e59eb4ca1c0fca6d35ee803e38951cb0343
|
||||
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
|
||||
F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
|
||||
F src/os_unix.c 3984fc069df59e26f000e30609611cecdb4e93293e6ee52313a473a7e874af1b
|
||||
F src/os_win.c 4c05a0587f38813c18bf3e9427e6be1cdf4763476bccbf335691bda3ea035e03
|
||||
F src/os_win.c 5c802f05e706c87c6e4cc6e9527f3364c7a7178458f93dffa5e19ac2e8eef9c1
|
||||
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
|
||||
F src/pager.c 2aa56a99bb13128d9102e84c7a9f835e546cbb58f0861d481bc3db32973b1628
|
||||
F src/pager.h 581698f2177e8bd4008fe4760898ce20b6133d1df22139b9101b5155f900df7a
|
||||
@ -1655,7 +1655,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 68e9a840d9cfbf4988e1a68c34e809d15d0235998cf0bfa147a1ab88ea842a61
|
||||
R f2ed4d392aa227fcb70e42ba4d74a495
|
||||
P fa3f5bcc23d9342f6df8ea15732988d637e9fa5dade85a73b05a9f66136d6964
|
||||
R 9677831c8749fca6b9258075623dae5d
|
||||
U drh
|
||||
Z ed7765808e7b49b8f24c258cf2e29075
|
||||
Z d25f7e57106bd66e6a2a3d4c1e5b9c3e
|
||||
|
@ -1 +1 @@
|
||||
fa3f5bcc23d9342f6df8ea15732988d637e9fa5dade85a73b05a9f66136d6964
|
||||
5d03c738e93d36815248991d9ed3d62297ba1bb966e602e7874410076c144f43
|
31
src/os_win.c
31
src/os_win.c
@ -4879,6 +4879,14 @@ static int winIsDir(const void *zConverted){
|
||||
return (attr!=INVALID_FILE_ATTRIBUTES) && (attr&FILE_ATTRIBUTE_DIRECTORY);
|
||||
}
|
||||
|
||||
/* forward reference */
|
||||
static int winAccess(
|
||||
sqlite3_vfs *pVfs, /* Not used on win32 */
|
||||
const char *zFilename, /* Name of file to check */
|
||||
int flags, /* Type of test to make on this file */
|
||||
int *pResOut /* OUT: Result */
|
||||
);
|
||||
|
||||
/*
|
||||
** Open a file.
|
||||
*/
|
||||
@ -5064,15 +5072,20 @@ static int winOpen(
|
||||
/* Noop */
|
||||
}
|
||||
#else
|
||||
while( (h = osCreateFileW((LPCWSTR)zConverted,
|
||||
dwDesiredAccess,
|
||||
dwShareMode, NULL,
|
||||
dwCreationDisposition,
|
||||
dwFlagsAndAttributes,
|
||||
NULL))==INVALID_HANDLE_VALUE &&
|
||||
winRetryIoerr(&cnt, &lastErrno) ){
|
||||
/* Noop */
|
||||
}
|
||||
do{
|
||||
h = osCreateFileW((LPCWSTR)zConverted,
|
||||
dwDesiredAccess,
|
||||
dwShareMode, NULL,
|
||||
dwCreationDisposition,
|
||||
dwFlagsAndAttributes,
|
||||
NULL);
|
||||
if( h!=INVALID_HANDLE_VALUE ) break;
|
||||
if( isReadWrite ){
|
||||
int isRO = 0;
|
||||
int rc2 = winAccess(pVfs, zName, SQLITE_ACCESS_READ, &isRO);
|
||||
if( rc2==SQLITE_OK && isRO ) break;
|
||||
}
|
||||
}while( winRetryIoerr(&cnt, &lastErrno) );
|
||||
#endif
|
||||
}
|
||||
#ifdef SQLITE_WIN32_HAS_ANSI
|
||||
|
Loading…
x
Reference in New Issue
Block a user