Check for failures in winTruncate. Ticket #3415. (CVS 5811)

FossilOrigin-Name: 500c50561fba88948aad21d1aef1e1e96ab8c3aa
This commit is contained in:
shane 2008-10-12 02:27:38 +00:00
parent e5447f5c1c
commit a3465f2d78
3 changed files with 17 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Added\s-DSQLITE_ENABLE_RTREE=1\sto\sthe\smkdll.sh\sscript.\sTicket\s#3427.\s(CVS\s5810)
D 2008-10-12T02:03:37
C Check\sfor\sfailures\sin\swinTruncate.\s\sTicket\s#3415.\s(CVS\s5811)
D 2008-10-12T02:27:39
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 2014e5a4010ad5ebbcaedff98240b3d14ee83838
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -137,7 +137,7 @@ F src/os.h ef8abeb9afc694b82dbd169a91c9b7e26db3c892
F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
F src/os_os2.c e391fc95adc744bbdcefd4d11e3066998185a0a0
F src/os_unix.c f33b69d8a85372b270fe37ee664a4c2140a5217d
F src/os_win.c 04033a86a39f49cb8e348f515eb0116aa9d36678
F src/os_win.c 13bed718f62d64031b17bb3685adcf994dbf0232
F src/pager.c d98f56128e849083f2f612196efebd982c491fea
F src/pager.h 9c1917be28fff58118e1fe0ddbc7adfb8dd4f44d
F src/parse.y f4620f42b5e0141e20243b5f963d0fc9c180ab9b
@ -648,7 +648,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 3ddda111867f64d9dfd729c50c4d0555cac1499d
R d7095f838634dd0d642e60614a14dbc5
P 66f57ecb1626f3c5292070c1b9a9c1a9a9164d4f
R d2184783a1dede3018139fe4efc9a35c
U shane
Z be3eaa2d5aff0ace2311fedf53f7c677
Z 353baa93eb7d9fe7bb0de61914f20a5a

View File

@ -1 +1 @@
66f57ecb1626f3c5292070c1b9a9c1a9a9164d4f
500c50561fba88948aad21d1aef1e1e96ab8c3aa

View File

@ -12,7 +12,7 @@
**
** This file contains code that is specific to windows.
**
** $Id: os_win.c,v 1.134 2008/09/30 04:20:08 shane Exp $
** $Id: os_win.c,v 1.135 2008/10/12 02:27:39 shane Exp $
*/
#include "sqliteInt.h"
#if SQLITE_OS_WIN /* This file is used for windows only */
@ -713,14 +713,20 @@ static int winWrite(
** Truncate an open file to a specified size
*/
static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){
DWORD rc;
LONG upperBits = (nByte>>32) & 0x7fffffff;
LONG lowerBits = nByte & 0xffffffff;
winFile *pFile = (winFile*)id;
OSTRACE3("TRUNCATE %d %lld\n", pFile->h, nByte);
SimulateIOError(return SQLITE_IOERR_TRUNCATE);
SetFilePointer(pFile->h, lowerBits, &upperBits, FILE_BEGIN);
SetEndOfFile(pFile->h);
return SQLITE_OK;
rc = SetFilePointer(pFile->h, lowerBits, &upperBits, FILE_BEGIN);
if( INVALID_SET_FILE_POINTER != rc ){
/* SetEndOfFile will fail if nByte is negative */
if( SetEndOfFile(pFile->h) ){
return SQLITE_OK;
}
}
return SQLITE_IOERR_TRUNCATE;
}
#ifdef SQLITE_TEST