1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-01-06 08:01:16 +03:00

Check the return code from sqlite3OsFileControl() in sqlite3BtreeCopyFile()

and report any errors that it generates.

FossilOrigin-Name: 7f852ac6435f1c9e25b07f816cca5ba40484579e
This commit is contained in:
drh
2012-01-10 16:40:50 +00:00
parent 92c45cf0fe
commit 2bfe5b316c
3 changed files with 11 additions and 8 deletions

View File

@@ -678,7 +678,9 @@ int sqlite3BtreeCopyFile(Btree *pTo, Btree *pFrom){
pFd = sqlite3PagerFile(sqlite3BtreePager(pTo));
if( pFd->pMethods ){
i64 nByte = sqlite3BtreeGetPageSize(pFrom)*(i64)sqlite3BtreeLastPage(pFrom);
sqlite3OsFileControl(pFd, SQLITE_FCNTL_OVERWRITE, &nByte);
rc = sqlite3OsFileControl(pFd, SQLITE_FCNTL_OVERWRITE, &nByte);
if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK;
if( rc ) goto copy_finished;
}
/* Set up an sqlite3_backup object. sqlite3_backup.pDestDb must be set
@@ -709,6 +711,7 @@ int sqlite3BtreeCopyFile(Btree *pTo, Btree *pFrom){
}
assert( sqlite3BtreeIsInTrans(pTo)==0 );
copy_finished:
sqlite3BtreeLeave(pFrom);
sqlite3BtreeLeave(pTo);
return rc;