diff options
author | dan <dan@noemail.net> | 2015-01-21 06:36:07 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2015-01-21 06:36:07 +0000 |
commit | 997d798d92a7f9bc72fa29174bc83d8c4cc5618d (patch) | |
tree | acbb3dba2e2b1000463eb801cdedb1f3261e6fd2 /src/os_unix.c | |
parent | fd0b436e1044867a5788c58d79c3a7976aa46874 (diff) | |
parent | fe201effbe35d38fdd198be93b23abe7583b2aa9 (diff) | |
download | sqlite-997d798d92a7f9bc72fa29174bc83d8c4cc5618d.tar.gz sqlite-997d798d92a7f9bc72fa29174bc83d8c4cc5618d.zip |
Merge latest trunk changes with this branch.
FossilOrigin-Name: b3348b1e07e168b156636a29fc8c6d6afb3129c2
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index f802d9cd1..ddd6a802e 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3386,9 +3386,9 @@ int sqlite3_fullsync_count = 0; ** We do not trust systems to provide a working fdatasync(). Some do. ** Others do no. To be safe, we will stick with the (slightly slower) ** fsync(). If you know that your system does support fdatasync() correctly, -** then simply compile with -Dfdatasync=fdatasync +** then simply compile with -Dfdatasync=fdatasync or -DHAVE_FDATASYNC */ -#if !defined(fdatasync) +#if !defined(fdatasync) && !HAVE_FDATASYNC # define fdatasync fsync #endif @@ -3717,6 +3717,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){ ** that do not have a real fallocate() call. */ int nBlk = buf.st_blksize; /* File-system block size */ + int nWrite = 0; /* Number of bytes written by seekAndWrite */ i64 iWrite; /* Next offset to write to */ iWrite = ((buf.st_size + 2*nBlk - 1)/nBlk)*nBlk-1; @@ -3724,11 +3725,11 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){ assert( (iWrite/nBlk)==((buf.st_size+nBlk-1)/nBlk) ); assert( ((iWrite+1)%nBlk)==0 ); for(/*no-op*/; iWrite<nSize; iWrite+=nBlk ){ - int nWrite = seekAndWrite(pFile, iWrite, "", 1); + nWrite = seekAndWrite(pFile, iWrite, "", 1); if( nWrite!=1 ) return SQLITE_IOERR_WRITE; } - if( nSize%nBlk ){ - int nWrite = seekAndWrite(pFile, nSize-1, "", 1); + if( nWrite==0 || (nSize%nBlk) ){ + nWrite = seekAndWrite(pFile, nSize-1, "", 1); if( nWrite!=1 ) return SQLITE_IOERR_WRITE; } #endif |