aboutsummaryrefslogtreecommitdiff
path: root/src/os_win.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2011-08-03 22:06:39 +0000
committerdrh <drh@noemail.net>2011-08-03 22:06:39 +0000
commitf9042e9682686c5bc77a539a493bccda9aff6002 (patch)
tree6ea0b8277e08dbf83990f9d3ccd4a5ae4e0f3ce1 /src/os_win.c
parent52043d7d456cede16b51f2f5f77dd7a3bb1ac59d (diff)
parent85e444cab43e5e648a6f95935713f3b54e89627f (diff)
downloadsqlite-f9042e9682686c5bc77a539a493bccda9aff6002.tar.gz
sqlite-f9042e9682686c5bc77a539a493bccda9aff6002.zip
Merge the winopen-retry-logic branch into trunk. The biggest change here
is to test scripts, which should now use such as copy_file and delete_file from tester.tcl rather than the raw file commands of TCL. FossilOrigin-Name: b90c28be3840169651022ef36cd7cf416bc22305
Diffstat (limited to 'src/os_win.c')
-rw-r--r--src/os_win.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/os_win.c b/src/os_win.c
index 0ca5db6b4..a006627bf 100644
--- a/src/os_win.c
+++ b/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"));