------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-C Make\sthe\sinitial\ssalt\svalues\sin\sthe\sWAL\sheader\srandom\svalues,\snot\szero.
-D 2010-07-07T21:06:49
+C Changes\sto\sos_win.c\sto\shave\sit\ssimulate\sIO\serrors\slike\sos_unix.c.
+D 2010-07-08T03:13:33
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in c4270a1cd7cd70a263b7e96a258aa90e9c3618eb
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
F src/os_os2.c 665876d5eec7585226b0a1cf5e18098de2b2da19
F src/os_unix.c c6112f0ae34f23ae5ca0189a685e084befbdcf26
-F src/os_win.c f0a56db57896466b25c82d224131a2b095352555
+F src/os_win.c b39c2c26342d6d4ceaaa4a5e764284444ae6ce98
F src/pager.c 1ef321efa5839ebc9e563ace6fce30bfa5bdb661
F src/pager.h 879fdde5a102d2f21a3135d6f647530b21c2796c
F src/parse.y ace5c7a125d9f2a410e431ee3209034105045f7e
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 0e4bd44682a252fb8af0df20f011b2b2364644b5
-R 3e8e721ad570d172d78ac52da59f315c
-U drh
-Z bbea7d03fc96221a5e3f6f38a5beffde
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.6 (GNU/Linux)
-
-iD8DBQFMNOxsoxKgR168RlERApuBAJ40foMMW47Y5m6c1u/ufgGGmwSnsACdGxBb
-d9W5kuIuF/VxgdHdziuXS4M=
-=n1OA
------END PGP SIGNATURE-----
+P baa5eddd0539342945c14a2793c2579efb7e3b26
+R 8a54ccb3e7c4dd33b01e301fc19bce15
+U shaneh
+Z 74994333182dfeeb327944a6c7be56de
OSTRACE(("CLOSE %d\n", pFile->h));
do{
rc = CloseHandle(pFile->h);
+ /* SimulateIOError( rc=0; cnt=MX_CLOSE_ATTEMPT; ); */
}while( rc==0 && ++cnt < MX_CLOSE_ATTEMPT && (Sleep(100), 1) );
#if SQLITE_OS_WINCE
#define WINCE_DELETION_ATTEMPTS 3
** Make sure all writes to a particular file are committed to disk.
*/
static int winSync(sqlite3_file *id, int flags){
-#ifndef SQLITE_NO_SYNC
+#if !defined(NDEBUG) || !defined(SQLITE_NO_SYNC) || defined(SQLITE_DEBUG)
winFile *pFile = (winFile*)id;
-
- assert( id!=0 );
- OSTRACE(("SYNC %d lock=%d\n", pFile->h, pFile->locktype));
#else
UNUSED_PARAMETER(id);
#endif
+
+ assert( pFile );
+ /* Check that one of SQLITE_SYNC_NORMAL or FULL was passed */
+ assert((flags&0x0F)==SQLITE_SYNC_NORMAL
+ || (flags&0x0F)==SQLITE_SYNC_FULL
+ );
+
+ OSTRACE(("SYNC %d lock=%d\n", pFile->h, pFile->locktype));
+
#ifndef SQLITE_TEST
UNUSED_PARAMETER(flags);
#else
}
sqlite3_sync_count++;
#endif
+
+ /* Unix cannot, but some systems may return SQLITE_FULL from here. This
+ ** line is to test that doing so does not cause any problems.
+ */
+ SimulateDiskfullError( return SQLITE_FULL );
+ SimulateIOError( return SQLITE_IOERR; );
+
/* If we compiled with the SQLITE_NO_SYNC flag, then syncing is a
** no-op
*/
#ifdef SQLITE_NO_SYNC
- return SQLITE_OK;
+ return SQLITE_OK;
#else
if( FlushFileBuffers(pFile->h) ){
return SQLITE_OK;
int rc;
winFile *pFile = (winFile*)id;
+ SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );
+
assert( id!=0 );
if( pFile->locktype>=RESERVED_LOCK ){
rc = 1;
}
case SQLITE_FCNTL_SIZE_HINT: {
sqlite3_int64 sz = *(sqlite3_int64*)pArg;
+ SimulateIOErrorBenign(1);
winTruncate(id, sz);
+ SimulateIOErrorBenign(0);
return SQLITE_OK;
}
}
UnmapViewOfFile(p->aRegion[i].pMap);
CloseHandle(p->aRegion[i].hMap);
}
- if( p->hFile.h != INVALID_HANDLE_VALUE ) {
+ if( p->hFile.h != INVALID_HANDLE_VALUE ){
+ SimulateIOErrorBenign(1);
winClose((sqlite3_file *)&p->hFile);
+ SimulateIOErrorBenign(0);
+ }
+ if( deleteFlag ){
+ SimulateIOErrorBenign(1);
+ winDelete(pVfs, p->zFilename, 0);
+ SimulateIOErrorBenign(0);
}
- if( deleteFlag ) winDelete(pVfs, p->zFilename, 0);
*pp = p->pNext;
sqlite3_free(p->aRegion);
sqlite3_free(p);
"0123456789";
size_t i, j;
char zTempPath[MAX_PATH+1];
+
+ /* It's odd to simulate an io-error here, but really this is just
+ ** using the io-error infrastructure to test that SQLite handles this
+ ** function failing.
+ */
+ SimulateIOError( return SQLITE_IOERR );
+
if( sqlite3_temp_directory ){
sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", sqlite3_temp_directory);
}else if( isNT() ){
}
#endif
}
+
+ /* Check that the output buffer is large enough for the temporary file
+ ** name. If it is not, return SQLITE_ERROR.
+ */
+ if( (sqlite3Strlen30(zTempPath) + sqlite3Strlen30(SQLITE_TEMP_FILE_PREFIX) + 17) >= nBuf ){
+ return SQLITE_ERROR;
+ }
+
for(i=sqlite3Strlen30(zTempPath); i>0 && zTempPath[i-1]=='\\'; i--){}
zTempPath[i] = 0;
- sqlite3_snprintf(nBuf-30, zBuf,
+
+ sqlite3_snprintf(nBuf-17, zBuf,
"%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPath);
j = sqlite3Strlen30(zBuf);
- sqlite3_randomness(20, &zBuf[j]);
- for(i=0; i<20; i++, j++){
+ sqlite3_randomness(15, &zBuf[j]);
+ for(i=0; i<15; i++, j++){
zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
}
zBuf[j] = 0;
+
OSTRACE(("TEMP FILENAME: %s\n", zBuf));
return SQLITE_OK;
}
int cnt = 0;
DWORD rc;
DWORD error = 0;
- void *zConverted = convertUtf8Filename(zFilename);
+ void *zConverted;
UNUSED_PARAMETER(pVfs);
UNUSED_PARAMETER(syncDir);
+
+ SimulateIOError(return SQLITE_IOERR_DELETE);
+ zConverted = convertUtf8Filename(zFilename);
if( zConverted==0 ){
return SQLITE_NOMEM;
}
- SimulateIOError(return SQLITE_IOERR_DELETE);
if( isNT() ){
do{
DeleteFileW(zConverted);
){
#if defined(__CYGWIN__)
+ SimulateIOError( return SQLITE_ERROR );
UNUSED_PARAMETER(nFull);
cygwin_conv_to_full_win32_path(zRelative, zFull);
return SQLITE_OK;
#endif
#if SQLITE_OS_WINCE
+ SimulateIOError( return SQLITE_ERROR );
UNUSED_PARAMETER(nFull);
/* WinCE has no concept of a relative pathname, or so I am told. */
sqlite3_snprintf(pVfs->mxPathname, zFull, "%s", zRelative);
int nByte;
void *zConverted;
char *zOut;
+
+ /* It's odd to simulate an io-error here, but really this is just
+ ** using the io-error infrastructure to test that SQLite handles this
+ ** function failing. This function could fail if, for example, the
+ ** current working directory has been unlinked.
+ */
+ SimulateIOError( return SQLITE_ERROR );
UNUSED_PARAMETER(nFull);
zConverted = convertUtf8Filename(zRelative);
if( isNT() ){
** to get the drive letter to look up the sector
** size.
*/
+ SimulateIOErrorBenign(1);
rc = winFullPathname(pVfs, zRelative, MAX_PATH, zFullpath);
+ SimulateIOErrorBenign(0);
if( rc == SQLITE_OK )
{
void *zConverted = convertUtf8Filename(zFullpath);