Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Revise logic in winDelete to check the file prior to attempting to delete it. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | av-defense |
Files: | files | file ages | folders |
SHA1: |
36f11acc531a524407e03c797a6a1bcf |
User & Date: | mistachkin 2011-07-12 14:02:47.638 |
Context
2011-07-12
| ||
14:38 | Merge the improved anti-virus defenses into the trunk. (check-in: 0207fd9b0c user: drh tags: trunk) | |
14:02 | Revise logic in winDelete to check the file prior to attempting to delete it. (Closed-Leaf check-in: 36f11acc53 user: mistachkin tags: av-defense) | |
13:51 | Improvements to the logging that occurs on an antivirus I/O retry. (check-in: ff0ff75c35 user: drh tags: av-defense) | |
Changes
Changes to src/os_win.c.
︙ | ︙ | |||
422 423 424 425 426 427 428 | */ static int retryIoerr(int *pnRetry){ DWORD e; if( *pnRetry>=SQLITE_WIN32_IOERR_RETRY ){ return 0; } e = GetLastError(); | > > | | 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | */ static int retryIoerr(int *pnRetry){ DWORD e; if( *pnRetry>=SQLITE_WIN32_IOERR_RETRY ){ return 0; } e = GetLastError(); if( e==ERROR_ACCESS_DENIED || e==ERROR_LOCK_VIOLATION || e==ERROR_SHARING_VIOLATION ){ Sleep(SQLITE_WIN32_IOERR_RETRY_DELAY*(1+*pnRetry)); ++*pnRetry; return 1; } return 0; } |
︙ | ︙ | |||
2384 2385 2386 2387 2388 2389 2390 | SimulateIOError(return SQLITE_IOERR_DELETE); zConverted = convertUtf8Filename(zFilename); if( zConverted==0 ){ return SQLITE_NOMEM; } if( isNT() ){ | > > | > > > | > | 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 | SimulateIOError(return SQLITE_IOERR_DELETE); zConverted = convertUtf8Filename(zFilename); if( zConverted==0 ){ return SQLITE_NOMEM; } if( isNT() ){ 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. ** 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{ rc = 1; while( GetFileAttributesA(zConverted)!=INVALID_FILE_ATTRIBUTES && (rc = DeleteFileA(zConverted))==0 && retryIoerr(&cnt) ){} rc = rc ? SQLITE_OK : SQLITE_ERROR; #endif } if( rc ){ rc = winLogError(SQLITE_IOERR_DELETE, "winDelete", zFilename); }else{ logIoerr(cnt); } |
︙ | ︙ |