/ Check-in [5bc8e564]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make multiple attempts to delete files marked DELETE_ON_CLOSE under WinCE. Ticket #2950. (CVS 4802)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:5bc8e564e3499ada01a6c3d74b1e6d6906d2a118
User & Date: drh 2008-02-20 00:00:00
Context
2008-02-21
02:09
Test coverage and documentation improvements. (CVS 4803) check-in: e0baceac user: drh tags: trunk
2008-02-20
00:00
Make multiple attempts to delete files marked DELETE_ON_CLOSE under WinCE. Ticket #2950. (CVS 4802) check-in: 5bc8e564 user: drh tags: trunk
2008-02-19
18:29
Remove instances of strcpy() from test code. Use memcpy() or sqlite3_snprintf() instead. (CVS 4801) check-in: 7b50140d user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_win.c.

   602    602     int rc, cnt = 0;
   603    603     winFile *pFile = (winFile*)id;
   604    604     OSTRACE2("CLOSE %d\n", pFile->h);
   605    605     do{
   606    606       rc = CloseHandle(pFile->h);
   607    607     }while( rc==0 && cnt++ < MX_CLOSE_ATTEMPT && (Sleep(100), 1) );
   608    608   #if OS_WINCE
          609  +#define WINCE_DELETION_ATTEMPTS 3
   609    610     winceDestroyLock(pFile);
   610    611     if( pFile->zDeleteOnClose ){
   611         -    DeleteFileW(pFile->zDeleteOnClose);
          612  +    int cnt = 0;
          613  +    while(
          614  +           DeleteFileW(pFile->zDeleteOnClose)==0
          615  +        && GetFileAttributesW(pFile->zDeleteOnClose)!=0xffffffff 
          616  +        && cnt++ < WINCE_DELETION_ATTEMPTS
          617  +    ){
          618  +       Sleep(100);  /* Wait a little before trying again */
          619  +    }
   612    620       free(pFile->zDeleteOnClose);
   613    621     }
   614    622   #endif
   615    623     OpenCounter(-1);
   616    624     return rc ? SQLITE_OK : SQLITE_IOERR;
   617    625   }
   618    626