mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-14 00:22:38 +03:00
Add retry logic for AV defense to winOpen. Also, refactor test suite to allow the key Tcl file operations (e.g. copy and delete) to be retried.
FossilOrigin-Name: 9007586fdabed8dbcc78581ea9821cfd1f9a4c8c
This commit is contained in:
33
src/os_win.c
33
src/os_win.c
@@ -2191,6 +2191,7 @@ static int winOpen(
|
||||
winFile *pFile = (winFile*)id;
|
||||
void *zConverted; /* Filename in OS encoding */
|
||||
const char *zUtf8Name = zName; /* Filename in UTF-8 encoding */
|
||||
int cnt = 0;
|
||||
|
||||
/* 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.
|
||||
@@ -2310,31 +2311,31 @@ static int winOpen(
|
||||
#endif
|
||||
|
||||
if( isNT() ){
|
||||
h = CreateFileW((WCHAR*)zConverted,
|
||||
dwDesiredAccess,
|
||||
dwShareMode,
|
||||
NULL,
|
||||
dwCreationDisposition,
|
||||
dwFlagsAndAttributes,
|
||||
NULL
|
||||
);
|
||||
while( (h = CreateFileW((WCHAR*)zConverted,
|
||||
dwDesiredAccess,
|
||||
dwShareMode, NULL,
|
||||
dwCreationDisposition,
|
||||
dwFlagsAndAttributes,
|
||||
NULL))==INVALID_HANDLE_VALUE &&
|
||||
retryIoerr(&cnt) ){}
|
||||
/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed.
|
||||
** Since the ASCII version of these Windows API do not exist for WINCE,
|
||||
** it's important to not reference them for WINCE builds.
|
||||
*/
|
||||
#if SQLITE_OS_WINCE==0
|
||||
}else{
|
||||
h = CreateFileA((char*)zConverted,
|
||||
dwDesiredAccess,
|
||||
dwShareMode,
|
||||
NULL,
|
||||
dwCreationDisposition,
|
||||
dwFlagsAndAttributes,
|
||||
NULL
|
||||
);
|
||||
while( (h = CreateFileA((char*)zConverted,
|
||||
dwDesiredAccess,
|
||||
dwShareMode, NULL,
|
||||
dwCreationDisposition,
|
||||
dwFlagsAndAttributes,
|
||||
NULL))==INVALID_HANDLE_VALUE &&
|
||||
retryIoerr(&cnt) ){}
|
||||
#endif
|
||||
}
|
||||
|
||||
logIoerr(cnt);
|
||||
|
||||
OSTRACE(("OPEN %d %s 0x%lx %s\n",
|
||||
h, zName, dwDesiredAccess,
|
||||
h==INVALID_HANDLE_VALUE ? "failed" : "ok"));
|
||||
|
||||
Reference in New Issue
Block a user