Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Do not overwrite small files (less than 1024 bytes) that are not databases. Ticket #1370. (CVS 2606) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
7f4302686e55f22b281d98a8a3b89300 |
User & Date: | drh 2005-08-21 16:54:25.000 |
Context
2005-08-21
| ||
17:48 | Do not create an error message if there is no error. (CVS 2607) (check-in: 3aa47c5587 user: drh tags: trunk) | |
16:54 | Do not overwrite small files (less than 1024 bytes) that are not databases. Ticket #1370. (CVS 2606) (check-in: 7f4302686e user: drh tags: trunk) | |
2005-08-20
| ||
13:47 | More test coverage improvements. (CVS 2605) (check-in: e559e810a5 user: drh tags: trunk) | |
Changes
Changes to src/pager.c.
︙ | ︙ | |||
14 15 16 17 18 19 20 | ** The pager is used to access a database disk file. It implements ** atomic commit and rollback through the use of a journal file that ** is separate from the database file. The pager also implements file ** locking to prevent two processes from writing the same database ** file simultaneously, or one process from reading the database while ** another is writing. ** | | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ** The pager is used to access a database disk file. It implements ** atomic commit and rollback through the use of a journal file that ** is separate from the database file. The pager also implements file ** locking to prevent two processes from writing the same database ** file simultaneously, or one process from reading the database while ** another is writing. ** ** @(#) $Id: pager.c,v 1.209 2005/08/21 16:54:25 drh Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" #include "os.h" #include "pager.h" #include <assert.h> #include <string.h> |
︙ | ︙ | |||
1754 1755 1756 1757 1758 1759 1760 | if( pPager->dbSize>=0 ){ return pPager->dbSize; } if( sqlite3OsFileSize(&pPager->fd, &n)!=SQLITE_OK ){ pPager->errMask |= PAGER_ERR_DISK; return 0; } | > > > | > | 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 | if( pPager->dbSize>=0 ){ return pPager->dbSize; } if( sqlite3OsFileSize(&pPager->fd, &n)!=SQLITE_OK ){ pPager->errMask |= PAGER_ERR_DISK; return 0; } if( n>0 && n<pPager->pageSize ){ n = 1; }else{ n /= pPager->pageSize; } if( !MEMDB && n==PENDING_BYTE/pPager->pageSize ){ n++; } if( pPager->state!=PAGER_UNLOCK ){ pPager->dbSize = n; } return n; |
︙ | ︙ |
Changes to test/misc5.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for miscellanous features that were # left out of other test files. # | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for miscellanous features that were # left out of other test files. # # $Id: misc5.test,v 1.4 2005/08/21 16:54:25 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Build records using the MakeRecord opcode such that the size of the # header is at the transition point in the size of a varint. # |
︙ | ︙ | |||
467 468 469 470 471 472 473 474 475 476 | WHERE artist <> '' ) ) ) ORDER BY LOWER(artist) ASC; } } {two} finish_test | > > > > > > > > > > > > > > > > | 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | WHERE artist <> '' ) ) ) ORDER BY LOWER(artist) ASC; } } {two} # Ticket #1370. Do not overwrite small files (less than 1024 bytes) # when trying to open them as a database. # do_test misc5-4.1 { db close file delete -force test.db set fd [open test.db w] puts $fd "This is not really a database" close $fd sqlite3 db test.db catchsql { CREATE TABLE t1(a,b,c); } } {1 {file is encrypted or is not a database}} finish_test |