mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Enable the SQLITE_FCNTL_SIZE_HINT on unix even if SQLITE_FCNTL_CHUNK_SIZE
has not been set. FossilOrigin-Name: 05c9832e5f6eb705f1dce4e65cf4e2d56512ff6b
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user