diff options
author | dan <dan@noemail.net> | 2011-04-06 19:15:45 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2011-04-06 19:15:45 +0000 |
commit | dc5df0f8244a6da268900c4f2daedb8754dcd448 (patch) | |
tree | 4d516a8f2975777520a89d4911949750d6806cc3 /src/os_unix.c | |
parent | bb2b4418673da6412cbd18622115aac092d6feee (diff) | |
download | sqlite-dc5df0f8244a6da268900c4f2daedb8754dcd448.tar.gz sqlite-dc5df0f8244a6da268900c4f2daedb8754dcd448.zip |
Fix a benign inaccuracy in the os_unix.c SQLITE_FCNTL_SIZE_HINT code.
FossilOrigin-Name: 61a6ccbe3c9c3ad5f35fb325e3c327cb19409925
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index 67dd06fc1..e3fa9ea46 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3398,18 +3398,17 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){ */ int nBlk = buf.st_blksize; /* File-system block size */ i64 iWrite; /* Next offset to write to */ - int nWrite; /* Return value from seekAndWrite() */ if( robust_ftruncate(pFile->h, nSize) ){ pFile->lastErrno = errno; return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath); } iWrite = ((buf.st_size + 2*nBlk - 1)/nBlk)*nBlk-1; - do { - nWrite = seekAndWrite(pFile, iWrite, "", 1); + while( iWrite<nSize ){ + int nWrite = seekAndWrite(pFile, iWrite, "", 1); + if( nWrite!=1 ) return SQLITE_IOERR_WRITE; iWrite += nBlk; - } while( nWrite==1 && iWrite<nSize ); - if( nWrite!=1 ) return SQLITE_IOERR_WRITE; + } #endif } } |