diff options
author | dan <dan@noemail.net> | 2012-11-09 20:17:26 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2012-11-09 20:17:26 +0000 |
commit | 9fc5b4a5399144db31b1bf88632ea615dcd5fb2f (patch) | |
tree | d1182f52492414c555c4b381b628fe2286518eae /src | |
parent | 9c0a8ee57c5ab9cd2c4547a669ad7f7b84791e20 (diff) | |
download | sqlite-9fc5b4a5399144db31b1bf88632ea615dcd5fb2f.tar.gz sqlite-9fc5b4a5399144db31b1bf88632ea615dcd5fb2f.zip |
Change os_unix.c to propagate ENOENT errors back to sqlite as SQLITE_IOERR_DELETE_NOENT. Have SQLite ignore these where they are benign and propagate them back to the caller where they may indicate a file-system malfunction of some description.
FossilOrigin-Name: bed9c172ce624ab7b5b9de9ad42444891717ad9a
Diffstat (limited to 'src')
-rw-r--r-- | src/os_unix.c | 9 | ||||
-rw-r--r-- | src/pager.c | 1 | ||||
-rw-r--r-- | src/sqlite.h.in | 1 |
3 files changed, 9 insertions, 2 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index 9b6c9401a..1de88f942 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -5374,8 +5374,13 @@ static int unixDelete( int rc = SQLITE_OK; UNUSED_PARAMETER(NotUsed); SimulateIOError(return SQLITE_IOERR_DELETE); - if( osUnlink(zPath)==(-1) && errno!=ENOENT ){ - return unixLogError(SQLITE_IOERR_DELETE, "unlink", zPath); + if( osUnlink(zPath)==(-1) ){ + if( errno==ENOENT ){ + rc = SQLITE_IOERR_DELETE_NOENT; + }else{ + rc = SQLITE_IOERR_DELETE; + } + return unixLogError(rc, "unlink", zPath); } #ifndef SQLITE_DISABLE_DIRSYNC if( (dirSync & 1)!=0 ){ diff --git a/src/pager.c b/src/pager.c index a96dc45b8..7c039e7a7 100644 --- a/src/pager.c +++ b/src/pager.c @@ -3159,6 +3159,7 @@ static int pagerOpenWalIfPresent(Pager *pPager){ if( rc ) return rc; if( nPage==0 ){ rc = sqlite3OsDelete(pPager->pVfs, pPager->zWal, 0); + if( rc==SQLITE_IOERR_DELETE_NOENT ) rc = SQLITE_OK; isWal = 0; }else{ rc = sqlite3OsAccess( diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 0d619e96c..520cccd04 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -469,6 +469,7 @@ int sqlite3_exec( #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) #define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8)) #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) +#define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8)) #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |