diff options
Diffstat (limited to 'src')
-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 |