diff options
author | drh <> | 2025-03-26 15:51:05 +0000 |
---|---|---|
committer | drh <> | 2025-03-26 15:51:05 +0000 |
commit | 4a6de7ff7cd1ab9e43dacd839659c203032ba887 (patch) | |
tree | 0a76dc8a12a6e273e16029d52458964044b48b26 /src | |
parent | 517a0e04d101782e184a4c05c997b2e9b2050141 (diff) | |
download | sqlite-4a6de7ff7cd1ab9e43dacd839659c203032ba887.tar.gz sqlite-4a6de7ff7cd1ab9e43dacd839659c203032ba887.zip |
Further attempted improvements at fast-fail for an inaccessible
database file.
FossilOrigin-Name: cdeb21a312d4f1a9e3009a0baf0af33857c172f7bc22bca047dcd46a03e9c964
Diffstat (limited to 'src')
-rw-r--r-- | src/os_win.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/os_win.c b/src/os_win.c index 03bdc30d0..29680b6eb 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -5309,6 +5309,7 @@ static int winOpen( void *zConverted; /* Filename in OS encoding */ const char *zUtf8Name = zName; /* Filename in UTF-8 encoding */ int cnt = 0; + int isRO = 0; /* file is known to be accessible readonly */ /* If argument zPath is a NULL pointer, this function is required to open ** a temporary file. Use this buffer to store the file name in. @@ -5473,7 +5474,7 @@ static int winOpen( &extendedParameters); if( h!=INVALID_HANDLE_VALUE ) break; if( isReadWrite && cnt==0 ){ - int rc2, isRO = 0; + int rc2; sqlite3BeginBenignMalloc(); rc2 = winAccess(pVfs, zUtf8Name, SQLITE_ACCESS_READ|NORETRY, &isRO); sqlite3EndBenignMalloc(); @@ -5490,7 +5491,7 @@ static int winOpen( NULL); if( h!=INVALID_HANDLE_VALUE ) break; if( isReadWrite && cnt==0 ){ - int rc2, isRO = 0; + int rc2; sqlite3BeginBenignMalloc(); rc2 = winAccess(pVfs, zUtf8Name, SQLITE_ACCESS_READ|NORETRY, &isRO); sqlite3EndBenignMalloc(); @@ -5510,7 +5511,7 @@ static int winOpen( NULL); if( h!=INVALID_HANDLE_VALUE ) break; if( isReadWrite && cnt==0 ){ - int rc2, isRO = 0; + int rc2; sqlite3BeginBenignMalloc(); rc2 = winAccess(pVfs, zUtf8Name, SQLITE_ACCESS_READ|NORETRY, &isRO); sqlite3EndBenignMalloc(); @@ -5527,7 +5528,7 @@ static int winOpen( if( h==INVALID_HANDLE_VALUE ){ sqlite3_free(zConverted); sqlite3_free(zTmpname); - if( isReadWrite && !isExclusive ){ + if( isReadWrite && isRO && !isExclusive ){ return winOpen(pVfs, zName, id, ((flags|SQLITE_OPEN_READONLY) & ~(SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE)), |