1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Do not overwrite small files (less than 1024 bytes) that are not databases.

Ticket #1370. (CVS 2606)

FossilOrigin-Name: 7f4302686e55f22b281d98a8a3b89300f4ce4eb6
This commit is contained in:
drh
2005-08-21 16:54:25 +00:00
parent f0bce09cdd
commit 992f2d781d
4 changed files with 31 additions and 11 deletions

View File

@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.208 2005/07/09 02:16:03 drh Exp $
** @(#) $Id: pager.c,v 1.209 2005/08/21 16:54:25 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@@ -1758,7 +1758,11 @@ int sqlite3pager_pagecount(Pager *pPager){
pPager->errMask |= PAGER_ERR_DISK;
return 0;
}
n /= pPager->pageSize;
if( n>0 && n<pPager->pageSize ){
n = 1;
}else{
n /= pPager->pageSize;
}
if( !MEMDB && n==PENDING_BYTE/pPager->pageSize ){
n++;
}