Revise logic in winDelete to check the file prior to attempting to delete it.

FossilOrigin-Name: 36f11acc531a524407e03c797a6a1bcf88bad809
This commit is contained in:
mistachkin 2011-07-12 14:02:47 +00:00
parent a32ad8434e
commit dc9e9587c6
3 changed files with 19 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Improvements\sto\sthe\slogging\sthat\soccurs\son\san\santivirus\sI/O\sretry. C Revise\slogic\sin\swinDelete\sto\scheck\sthe\sfile\sprior\sto\sattempting\sto\sdelete\sit.
D 2011-07-12T13:51:05.210 D 2011-07-12T14:02:47.638
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e F Makefile.in c1d7a7f4fd8da6b1815032efca950e3d5125407e
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -166,7 +166,7 @@ F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9
F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
F src/os_unix.c d3e7b17100704ee0fe2ef71a98c478b947480f4d F src/os_unix.c d3e7b17100704ee0fe2ef71a98c478b947480f4d
F src/os_win.c 07050df9e4956f8a8bb8983788b2523fd6e7db87 F src/os_win.c 57778b70d209f30070dc70e0e9f8e4adba0de5bc
F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41 F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41
F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
@ -952,7 +952,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5
F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576 F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262 F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262
P 89f1848d7f7d98b4f7da9218f99ed90d22dd43a8 P ff0ff75c3559f5bbe29c73204cc8ff1cb80f42cb
R 060b096970846ad68ec6f99f0023cc33 R 15ec97d6baeea0684b5deea8be1be88e
U drh U mistachkin
Z 9da4b869d45a82433907baf19d8c1435 Z 94bbfee187493f0fa246b9c95f6c61dc

View File

@ -1 +1 @@
ff0ff75c3559f5bbe29c73204cc8ff1cb80f42cb 36f11acc531a524407e03c797a6a1bcf88bad809

View File

@ -426,7 +426,9 @@ static int retryIoerr(int *pnRetry){
return 0; return 0;
} }
e = GetLastError(); e = GetLastError();
if( e==ERROR_LOCK_VIOLATION || e==ERROR_SHARING_VIOLATION ){ if( e==ERROR_ACCESS_DENIED ||
e==ERROR_LOCK_VIOLATION ||
e==ERROR_SHARING_VIOLATION ){
Sleep(SQLITE_WIN32_IOERR_RETRY_DELAY*(1+*pnRetry)); Sleep(SQLITE_WIN32_IOERR_RETRY_DELAY*(1+*pnRetry));
++*pnRetry; ++*pnRetry;
return 1; return 1;
@ -2388,14 +2390,20 @@ static int winDelete(
return SQLITE_NOMEM; return SQLITE_NOMEM;
} }
if( isNT() ){ if( isNT() ){
while( (rc = DeleteFileW(zConverted))!=0 || retryIoerr(&cnt) ){} rc = 1;
while( GetFileAttributesW(zConverted)!=INVALID_FILE_ATTRIBUTES &&
(rc = DeleteFileW(zConverted))==0 && retryIoerr(&cnt) ){}
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 ASCII version of these Windows API do not exist for WINCE, ** Since the ASCII 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.
*/ */
#if SQLITE_OS_WINCE==0 #if SQLITE_OS_WINCE==0
}else{ }else{
while( (rc = DeleteFileW(zConverted))!=0 || retryIoerr(&cnt) ){} rc = 1;
while( GetFileAttributesA(zConverted)!=INVALID_FILE_ATTRIBUTES &&
(rc = DeleteFileA(zConverted))==0 && retryIoerr(&cnt) ){}
rc = rc ? SQLITE_OK : SQLITE_ERROR;
#endif #endif
} }
if( rc ){ if( rc ){