aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2015-09-01 23:51:53 +0000
committerdrh <drh@noemail.net>2015-09-01 23:51:53 +0000
commit02bf8b45b7a12ec3cb78046c0b15c91a4e0e6d64 (patch)
tree680975cd2aa0e9678bf2d8e5f5e9337ce476e028 /src/os_unix.c
parent59a5364cf9578fe283c6066bf6940de4fb49dd8d (diff)
downloadsqlite-02bf8b45b7a12ec3cb78046c0b15c91a4e0e6d64.tar.gz
sqlite-02bf8b45b7a12ec3cb78046c0b15c91a4e0e6d64.zip
Very minor optimizations in the unix VFS.
FossilOrigin-Name: 6db3ff45bc15ece29cb2c7a736e5c6d005dde200
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index d7a94ab09..53a4fd31b 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -3146,7 +3146,6 @@ static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){
TIMER_START;
assert( cnt==(cnt&0x1ffff) );
assert( id->h>2 );
- cnt &= 0x1ffff;
do{
#if defined(USE_PREAD)
got = osPread(id->h, pBuf, cnt, offset);
@@ -3363,8 +3362,8 @@ static int unixWrite(
}
}
#endif
-
- while( amt>0 && (wrote = seekAndWrite(pFile, offset, pBuf, amt))>0 ){
+
+ while( (wrote = seekAndWrite(pFile, offset, pBuf, amt))<amt && wrote>0 ){
amt -= wrote;
offset += wrote;
pBuf = &((char*)pBuf)[wrote];
@@ -3372,7 +3371,7 @@ static int unixWrite(
SimulateIOError(( wrote=(-1), amt=1 ));
SimulateDiskfullError(( wrote=0, amt=1 ));
- if( amt>0 ){
+ if( amt>wrote ){
if( wrote<0 && pFile->lastErrno!=ENOSPC ){
/* lastErrno set by seekAndWrite */
return SQLITE_IOERR_WRITE;