mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-14 00:22:38 +03:00
Cleanup the semantics surrounding use of the GetLastError function on Windows.
FossilOrigin-Name: 7e657bbb800107c992a6ee7a3b35bc0a073bf3e4
This commit is contained in:
17
manifest
17
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Change\sthe\smultiplexor\sto\suse\sa\s3-digit\ssuffix.
|
C Cleanup\sthe\ssemantics\ssurrounding\suse\sof\sthe\sGetLastError\sfunction\son\sWindows.
|
||||||
D 2011-11-18T13:10:51.946
|
D 2011-11-21T00:54:37.897
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in 5b4a3e12a850b021547e43daf886b25133b44c07
|
F Makefile.in 5b4a3e12a850b021547e43daf886b25133b44c07
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -167,7 +167,7 @@ F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9
|
|||||||
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
|
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
|
||||||
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
|
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
|
||||||
F src/os_unix.c 4fbb91726165e105c1679a2660f49a3f4c376e4f
|
F src/os_unix.c 4fbb91726165e105c1679a2660f49a3f4c376e4f
|
||||||
F src/os_win.c a22b88d2c088c09a678a471abafa8d60dbf56803
|
F src/os_win.c 6efe66a38215c38eaa7603ee5f76848159f8669d
|
||||||
F src/pager.c d981f3bfcc0e4460537d983899620700ccf8f539
|
F src/pager.c d981f3bfcc0e4460537d983899620700ccf8f539
|
||||||
F src/pager.h 5cd760857707529b403837d813d86b68938d6183
|
F src/pager.h 5cd760857707529b403837d813d86b68938d6183
|
||||||
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
|
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
|
||||||
@@ -976,7 +976,10 @@ F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06
|
|||||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||||
F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
|
F tool/warnings-clang.sh 9f406d66e750e8ac031c63a9ef3248aaa347ef2a
|
||||||
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
||||||
P 1c45b2a0c055f6fc5da9d00ae2e9171099d904d4 06e0cdaf9112f722c23692e25c5b1f99b61c2d78
|
P 0b7edc44757660c8a5ae3b91cbcc3e6afd419b28
|
||||||
R d62e550a3406a1fdeec14ac20b144781
|
R 99aff9fc0229e676974ede97756eda75
|
||||||
U drh
|
T *branch * winGetLastError
|
||||||
Z d184ad6817e342a5dbefa36cc13c5962
|
T *sym-winGetLastError *
|
||||||
|
T -sym-trunk *
|
||||||
|
U mistachkin
|
||||||
|
Z 7ff767419ae0d15068d14c36ad0bea1d
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
0b7edc44757660c8a5ae3b91cbcc3e6afd419b28
|
7e657bbb800107c992a6ee7a3b35bc0a073bf3e4
|
||||||
71
src/os_win.c
71
src/os_win.c
@@ -1170,12 +1170,14 @@ static int win32IoerrRetryDelay = SQLITE_WIN32_IOERR_RETRY_DELAY;
|
|||||||
** to see if it should be retried. Return TRUE to retry. Return FALSE
|
** to see if it should be retried. Return TRUE to retry. Return FALSE
|
||||||
** to give up with an error.
|
** to give up with an error.
|
||||||
*/
|
*/
|
||||||
static int retryIoerr(int *pnRetry){
|
static int retryIoerr(int *pnRetry, DWORD *pError){
|
||||||
DWORD e;
|
DWORD e = osGetLastError();
|
||||||
if( *pnRetry>=win32IoerrRetry ){
|
if( *pnRetry>=win32IoerrRetry ){
|
||||||
|
if( pError ){
|
||||||
|
*pError = e;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
e = osGetLastError();
|
|
||||||
if( e==ERROR_ACCESS_DENIED ||
|
if( e==ERROR_ACCESS_DENIED ||
|
||||||
e==ERROR_LOCK_VIOLATION ||
|
e==ERROR_LOCK_VIOLATION ||
|
||||||
e==ERROR_SHARING_VIOLATION ){
|
e==ERROR_SHARING_VIOLATION ){
|
||||||
@@ -1183,6 +1185,9 @@ static int retryIoerr(int *pnRetry){
|
|||||||
++*pnRetry;
|
++*pnRetry;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if( pError ){
|
||||||
|
*pError = e;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1539,6 +1544,7 @@ static int seekWinFile(winFile *pFile, sqlite3_int64 iOffset){
|
|||||||
LONG upperBits; /* Most sig. 32 bits of new offset */
|
LONG upperBits; /* Most sig. 32 bits of new offset */
|
||||||
LONG lowerBits; /* Least sig. 32 bits of new offset */
|
LONG lowerBits; /* Least sig. 32 bits of new offset */
|
||||||
DWORD dwRet; /* Value returned by SetFilePointer() */
|
DWORD dwRet; /* Value returned by SetFilePointer() */
|
||||||
|
DWORD lastErrno; /* Value returned by GetLastError() */
|
||||||
|
|
||||||
upperBits = (LONG)((iOffset>>32) & 0x7fffffff);
|
upperBits = (LONG)((iOffset>>32) & 0x7fffffff);
|
||||||
lowerBits = (LONG)(iOffset & 0xffffffff);
|
lowerBits = (LONG)(iOffset & 0xffffffff);
|
||||||
@@ -1551,8 +1557,10 @@ static int seekWinFile(winFile *pFile, sqlite3_int64 iOffset){
|
|||||||
** GetLastError().
|
** GetLastError().
|
||||||
*/
|
*/
|
||||||
dwRet = osSetFilePointer(pFile->h, lowerBits, &upperBits, FILE_BEGIN);
|
dwRet = osSetFilePointer(pFile->h, lowerBits, &upperBits, FILE_BEGIN);
|
||||||
if( (dwRet==INVALID_SET_FILE_POINTER && osGetLastError()!=NO_ERROR) ){
|
|
||||||
pFile->lastErrno = osGetLastError();
|
if( (dwRet==INVALID_SET_FILE_POINTER
|
||||||
|
&& ((lastErrno = osGetLastError())!=NO_ERROR)) ){
|
||||||
|
pFile->lastErrno = lastErrno;
|
||||||
winLogError(SQLITE_IOERR_SEEK, pFile->lastErrno,
|
winLogError(SQLITE_IOERR_SEEK, pFile->lastErrno,
|
||||||
"seekWinFile", pFile->zPath);
|
"seekWinFile", pFile->zPath);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -1628,8 +1636,9 @@ static int winRead(
|
|||||||
return SQLITE_FULL;
|
return SQLITE_FULL;
|
||||||
}
|
}
|
||||||
while( !osReadFile(pFile->h, pBuf, amt, &nRead, 0) ){
|
while( !osReadFile(pFile->h, pBuf, amt, &nRead, 0) ){
|
||||||
if( retryIoerr(&nRetry) ) continue;
|
DWORD lastErrno;
|
||||||
pFile->lastErrno = osGetLastError();
|
if( retryIoerr(&nRetry, &lastErrno) ) continue;
|
||||||
|
pFile->lastErrno = lastErrno;
|
||||||
return winLogError(SQLITE_IOERR_READ, pFile->lastErrno,
|
return winLogError(SQLITE_IOERR_READ, pFile->lastErrno,
|
||||||
"winRead", pFile->zPath);
|
"winRead", pFile->zPath);
|
||||||
}
|
}
|
||||||
@@ -1669,10 +1678,11 @@ static int winWrite(
|
|||||||
u8 *aRem = (u8 *)pBuf; /* Data yet to be written */
|
u8 *aRem = (u8 *)pBuf; /* Data yet to be written */
|
||||||
int nRem = amt; /* Number of bytes yet to be written */
|
int nRem = amt; /* Number of bytes yet to be written */
|
||||||
DWORD nWrite; /* Bytes written by each WriteFile() call */
|
DWORD nWrite; /* Bytes written by each WriteFile() call */
|
||||||
|
DWORD lastErrno = NO_ERROR; /* Value returned by GetLastError() */
|
||||||
|
|
||||||
while( nRem>0 ){
|
while( nRem>0 ){
|
||||||
if( !osWriteFile(pFile->h, aRem, nRem, &nWrite, 0) ){
|
if( !osWriteFile(pFile->h, aRem, nRem, &nWrite, 0) ){
|
||||||
if( retryIoerr(&nRetry) ) continue;
|
if( retryIoerr(&nRetry, &lastErrno) ) continue;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if( nWrite<=0 ) break;
|
if( nWrite<=0 ) break;
|
||||||
@@ -1680,7 +1690,7 @@ static int winWrite(
|
|||||||
nRem -= nWrite;
|
nRem -= nWrite;
|
||||||
}
|
}
|
||||||
if( nRem>0 ){
|
if( nRem>0 ){
|
||||||
pFile->lastErrno = osGetLastError();
|
pFile->lastErrno = lastErrno;
|
||||||
rc = 1;
|
rc = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1810,15 +1820,15 @@ static int winFileSize(sqlite3_file *id, sqlite3_int64 *pSize){
|
|||||||
DWORD upperBits;
|
DWORD upperBits;
|
||||||
DWORD lowerBits;
|
DWORD lowerBits;
|
||||||
winFile *pFile = (winFile*)id;
|
winFile *pFile = (winFile*)id;
|
||||||
DWORD error;
|
DWORD lastErrno;
|
||||||
|
|
||||||
assert( id!=0 );
|
assert( id!=0 );
|
||||||
SimulateIOError(return SQLITE_IOERR_FSTAT);
|
SimulateIOError(return SQLITE_IOERR_FSTAT);
|
||||||
lowerBits = osGetFileSize(pFile->h, &upperBits);
|
lowerBits = osGetFileSize(pFile->h, &upperBits);
|
||||||
if( (lowerBits == INVALID_FILE_SIZE)
|
if( (lowerBits == INVALID_FILE_SIZE)
|
||||||
&& ((error = osGetLastError()) != NO_ERROR) )
|
&& ((lastErrno = osGetLastError())!=NO_ERROR) )
|
||||||
{
|
{
|
||||||
pFile->lastErrno = error;
|
pFile->lastErrno = lastErrno;
|
||||||
return winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno,
|
return winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno,
|
||||||
"winFileSize", pFile->zPath);
|
"winFileSize", pFile->zPath);
|
||||||
}
|
}
|
||||||
@@ -1869,6 +1879,7 @@ static int getReadLock(winFile *pFile){
|
|||||||
*/
|
*/
|
||||||
static int unlockReadLock(winFile *pFile){
|
static int unlockReadLock(winFile *pFile){
|
||||||
int res;
|
int res;
|
||||||
|
DWORD lastErrno;
|
||||||
if( isNT() ){
|
if( isNT() ){
|
||||||
res = osUnlockFile(pFile->h, SHARED_FIRST, 0, SHARED_SIZE, 0);
|
res = osUnlockFile(pFile->h, SHARED_FIRST, 0, SHARED_SIZE, 0);
|
||||||
/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed.
|
/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed.
|
||||||
@@ -1878,8 +1889,8 @@ static int unlockReadLock(winFile *pFile){
|
|||||||
res = osUnlockFile(pFile->h, SHARED_FIRST + pFile->sharedLockByte, 0, 1, 0);
|
res = osUnlockFile(pFile->h, SHARED_FIRST + pFile->sharedLockByte, 0, 1, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if( res==0 && osGetLastError()!=ERROR_NOT_LOCKED ){
|
if( res==0 && ((lastErrno = osGetLastError())!=ERROR_NOT_LOCKED) ){
|
||||||
pFile->lastErrno = osGetLastError();
|
pFile->lastErrno = lastErrno;
|
||||||
winLogError(SQLITE_IOERR_UNLOCK, pFile->lastErrno,
|
winLogError(SQLITE_IOERR_UNLOCK, pFile->lastErrno,
|
||||||
"unlockReadLock", pFile->zPath);
|
"unlockReadLock", pFile->zPath);
|
||||||
}
|
}
|
||||||
@@ -1918,7 +1929,7 @@ static int winLock(sqlite3_file *id, int locktype){
|
|||||||
int newLocktype; /* Set pFile->locktype to this value before exiting */
|
int newLocktype; /* Set pFile->locktype to this value before exiting */
|
||||||
int gotPendingLock = 0;/* True if we acquired a PENDING lock this time */
|
int gotPendingLock = 0;/* True if we acquired a PENDING lock this time */
|
||||||
winFile *pFile = (winFile*)id;
|
winFile *pFile = (winFile*)id;
|
||||||
DWORD error = NO_ERROR;
|
DWORD lastErrno = NO_ERROR;
|
||||||
|
|
||||||
assert( id!=0 );
|
assert( id!=0 );
|
||||||
OSTRACE(("LOCK %d %d was %d(%d)\n",
|
OSTRACE(("LOCK %d %d was %d(%d)\n",
|
||||||
@@ -1960,7 +1971,7 @@ static int winLock(sqlite3_file *id, int locktype){
|
|||||||
}
|
}
|
||||||
gotPendingLock = res;
|
gotPendingLock = res;
|
||||||
if( !res ){
|
if( !res ){
|
||||||
error = osGetLastError();
|
lastErrno = osGetLastError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1972,7 +1983,7 @@ static int winLock(sqlite3_file *id, int locktype){
|
|||||||
if( res ){
|
if( res ){
|
||||||
newLocktype = SHARED_LOCK;
|
newLocktype = SHARED_LOCK;
|
||||||
}else{
|
}else{
|
||||||
error = osGetLastError();
|
lastErrno = osGetLastError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1984,7 +1995,7 @@ static int winLock(sqlite3_file *id, int locktype){
|
|||||||
if( res ){
|
if( res ){
|
||||||
newLocktype = RESERVED_LOCK;
|
newLocktype = RESERVED_LOCK;
|
||||||
}else{
|
}else{
|
||||||
error = osGetLastError();
|
lastErrno = osGetLastError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2005,8 +2016,8 @@ static int winLock(sqlite3_file *id, int locktype){
|
|||||||
if( res ){
|
if( res ){
|
||||||
newLocktype = EXCLUSIVE_LOCK;
|
newLocktype = EXCLUSIVE_LOCK;
|
||||||
}else{
|
}else{
|
||||||
error = osGetLastError();
|
lastErrno = osGetLastError();
|
||||||
OSTRACE(("error-code = %d\n", error));
|
OSTRACE(("error-code = %d\n", lastErrno));
|
||||||
getReadLock(pFile);
|
getReadLock(pFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2026,7 +2037,7 @@ static int winLock(sqlite3_file *id, int locktype){
|
|||||||
}else{
|
}else{
|
||||||
OSTRACE(("LOCK FAILED %d trying for %d but got %d\n", pFile->h,
|
OSTRACE(("LOCK FAILED %d trying for %d but got %d\n", pFile->h,
|
||||||
locktype, newLocktype));
|
locktype, newLocktype));
|
||||||
pFile->lastErrno = error;
|
pFile->lastErrno = lastErrno;
|
||||||
rc = SQLITE_BUSY;
|
rc = SQLITE_BUSY;
|
||||||
}
|
}
|
||||||
pFile->locktype = (u8)newLocktype;
|
pFile->locktype = (u8)newLocktype;
|
||||||
@@ -2964,6 +2975,7 @@ static int winOpen(
|
|||||||
int *pOutFlags /* Status return flags */
|
int *pOutFlags /* Status return flags */
|
||||||
){
|
){
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
|
DWORD lastErrno;
|
||||||
DWORD dwDesiredAccess;
|
DWORD dwDesiredAccess;
|
||||||
DWORD dwShareMode;
|
DWORD dwShareMode;
|
||||||
DWORD dwCreationDisposition;
|
DWORD dwCreationDisposition;
|
||||||
@@ -3100,7 +3112,7 @@ static int winOpen(
|
|||||||
dwCreationDisposition,
|
dwCreationDisposition,
|
||||||
dwFlagsAndAttributes,
|
dwFlagsAndAttributes,
|
||||||
NULL))==INVALID_HANDLE_VALUE &&
|
NULL))==INVALID_HANDLE_VALUE &&
|
||||||
retryIoerr(&cnt) ){}
|
retryIoerr(&cnt, &lastErrno) ){}
|
||||||
/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed.
|
/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed.
|
||||||
** Since the ANSI version of these Windows API do not exist for WINCE,
|
** Since the ANSI version of these Windows API do not exist for WINCE,
|
||||||
** it's important to not reference them for WINCE builds.
|
** it's important to not reference them for WINCE builds.
|
||||||
@@ -3113,7 +3125,7 @@ static int winOpen(
|
|||||||
dwCreationDisposition,
|
dwCreationDisposition,
|
||||||
dwFlagsAndAttributes,
|
dwFlagsAndAttributes,
|
||||||
NULL))==INVALID_HANDLE_VALUE &&
|
NULL))==INVALID_HANDLE_VALUE &&
|
||||||
retryIoerr(&cnt) ){}
|
retryIoerr(&cnt, &lastErrno) ){}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3124,7 +3136,7 @@ static int winOpen(
|
|||||||
h==INVALID_HANDLE_VALUE ? "failed" : "ok"));
|
h==INVALID_HANDLE_VALUE ? "failed" : "ok"));
|
||||||
|
|
||||||
if( h==INVALID_HANDLE_VALUE ){
|
if( h==INVALID_HANDLE_VALUE ){
|
||||||
pFile->lastErrno = osGetLastError();
|
pFile->lastErrno = lastErrno;
|
||||||
winLogError(SQLITE_CANTOPEN, pFile->lastErrno, "winOpen", zUtf8Name);
|
winLogError(SQLITE_CANTOPEN, pFile->lastErrno, "winOpen", zUtf8Name);
|
||||||
sqlite3_free(zConverted);
|
sqlite3_free(zConverted);
|
||||||
if( isReadWrite && !isExclusive ){
|
if( isReadWrite && !isExclusive ){
|
||||||
@@ -3191,6 +3203,7 @@ static int winDelete(
|
|||||||
){
|
){
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
int rc;
|
int rc;
|
||||||
|
DWORD lastErrno;
|
||||||
void *zConverted;
|
void *zConverted;
|
||||||
UNUSED_PARAMETER(pVfs);
|
UNUSED_PARAMETER(pVfs);
|
||||||
UNUSED_PARAMETER(syncDir);
|
UNUSED_PARAMETER(syncDir);
|
||||||
@@ -3203,7 +3216,7 @@ static int winDelete(
|
|||||||
if( isNT() ){
|
if( isNT() ){
|
||||||
rc = 1;
|
rc = 1;
|
||||||
while( osGetFileAttributesW(zConverted)!=INVALID_FILE_ATTRIBUTES &&
|
while( osGetFileAttributesW(zConverted)!=INVALID_FILE_ATTRIBUTES &&
|
||||||
(rc = osDeleteFileW(zConverted))==0 && retryIoerr(&cnt) ){}
|
(rc = osDeleteFileW(zConverted))==0 && retryIoerr(&cnt, &lastErrno) ){}
|
||||||
rc = rc ? SQLITE_OK : SQLITE_ERROR;
|
rc = rc ? SQLITE_OK : SQLITE_ERROR;
|
||||||
/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed.
|
/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed.
|
||||||
** Since the ANSI version of these Windows API do not exist for WINCE,
|
** Since the ANSI version of these Windows API do not exist for WINCE,
|
||||||
@@ -3213,12 +3226,12 @@ static int winDelete(
|
|||||||
}else{
|
}else{
|
||||||
rc = 1;
|
rc = 1;
|
||||||
while( osGetFileAttributesA(zConverted)!=INVALID_FILE_ATTRIBUTES &&
|
while( osGetFileAttributesA(zConverted)!=INVALID_FILE_ATTRIBUTES &&
|
||||||
(rc = osDeleteFileA(zConverted))==0 && retryIoerr(&cnt) ){}
|
(rc = osDeleteFileA(zConverted))==0 && retryIoerr(&cnt, &lastErrno) ){}
|
||||||
rc = rc ? SQLITE_OK : SQLITE_ERROR;
|
rc = rc ? SQLITE_OK : SQLITE_ERROR;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if( rc ){
|
if( rc ){
|
||||||
rc = winLogError(SQLITE_IOERR_DELETE, osGetLastError(),
|
rc = winLogError(SQLITE_IOERR_DELETE, lastErrno,
|
||||||
"winDelete", zFilename);
|
"winDelete", zFilename);
|
||||||
}else{
|
}else{
|
||||||
logIoerr(cnt);
|
logIoerr(cnt);
|
||||||
@@ -3239,6 +3252,7 @@ static int winAccess(
|
|||||||
){
|
){
|
||||||
DWORD attr;
|
DWORD attr;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
DWORD lastErrno;
|
||||||
void *zConverted;
|
void *zConverted;
|
||||||
UNUSED_PARAMETER(pVfs);
|
UNUSED_PARAMETER(pVfs);
|
||||||
|
|
||||||
@@ -3253,7 +3267,7 @@ static int winAccess(
|
|||||||
memset(&sAttrData, 0, sizeof(sAttrData));
|
memset(&sAttrData, 0, sizeof(sAttrData));
|
||||||
while( !(rc = osGetFileAttributesExW((LPCWSTR)zConverted,
|
while( !(rc = osGetFileAttributesExW((LPCWSTR)zConverted,
|
||||||
GetFileExInfoStandard,
|
GetFileExInfoStandard,
|
||||||
&sAttrData)) && retryIoerr(&cnt) ){}
|
&sAttrData)) && retryIoerr(&cnt, &lastErrno) ){}
|
||||||
if( rc ){
|
if( rc ){
|
||||||
/* For an SQLITE_ACCESS_EXISTS query, treat a zero-length file
|
/* For an SQLITE_ACCESS_EXISTS query, treat a zero-length file
|
||||||
** as if it does not exist.
|
** as if it does not exist.
|
||||||
@@ -3266,7 +3280,6 @@ static int winAccess(
|
|||||||
attr = sAttrData.dwFileAttributes;
|
attr = sAttrData.dwFileAttributes;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
DWORD lastErrno = osGetLastError();
|
|
||||||
logIoerr(cnt);
|
logIoerr(cnt);
|
||||||
if( lastErrno!=ERROR_FILE_NOT_FOUND ){
|
if( lastErrno!=ERROR_FILE_NOT_FOUND ){
|
||||||
winLogError(SQLITE_IOERR_ACCESS, lastErrno, "winAccess", zFilename);
|
winLogError(SQLITE_IOERR_ACCESS, lastErrno, "winAccess", zFilename);
|
||||||
|
|||||||
Reference in New Issue
Block a user