diff options
author | drh <drh@noemail.net> | 2011-07-25 23:25:47 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2011-07-25 23:25:47 +0000 |
commit | 7d2dc7156ce267ca844793c20cd0c510a698de4b (patch) | |
tree | 4277597d23b73f6bfc2f2d46e99df7b1090cdb12 /src/os_unix.c | |
parent | 5d22e41f2d0aaa5c824c62c4cfb498de6e2ac2f2 (diff) | |
download | sqlite-7d2dc7156ce267ca844793c20cd0c510a698de4b.tar.gz sqlite-7d2dc7156ce267ca844793c20cd0c510a698de4b.zip |
Enable the SQLITE_FCNTL_SIZE_HINT on unix even if SQLITE_FCNTL_CHUNK_SIZE
has not been set.
FossilOrigin-Name: 05c9832e5f6eb705f1dce4e65cf4e2d56512ff6b
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index b2956c164..dce13e536 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3395,13 +3395,19 @@ static int proxyFileControl(sqlite3_file*,int,void*); ** SQLITE_FCNTL_SIZE_HINT operation is a no-op for Unix. */ static int fcntlSizeHint(unixFile *pFile, i64 nByte){ - if( pFile->szChunk ){ + { /* preserve indentation of removed "if" */ i64 nSize; /* Required file size */ + i64 szChunk; /* Chunk size */ struct stat buf; /* Used to hold return values of fstat() */ if( osFstat(pFile->h, &buf) ) return SQLITE_IOERR_FSTAT; - nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk; + szChunk = pFile->szChunk; + if( szChunk==0 ){ + nSize = nByte; + }else{ + nSize = ((nByte+szChunk-1) / szChunk) * szChunk; + } if( nSize>(i64)buf.st_size ){ #if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE |