mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
In the zipfile extension, leave the catalog list in a consistent state when
the last entry is removed from the list. [forum:/info/f03f1e4c5a5c9959|forum post f03f1e4c5a5c9959]. FossilOrigin-Name: 1b489d008b7bda12f9bf92e246bc613ef61e9c74ace0652d6d088e5a6e0696f6
This commit is contained in:
@ -1537,9 +1537,19 @@ static u32 zipfileGetTime(sqlite3_value *pVal){
|
||||
*/
|
||||
static void zipfileRemoveEntryFromList(ZipfileTab *pTab, ZipfileEntry *pOld){
|
||||
if( pOld ){
|
||||
ZipfileEntry **pp;
|
||||
for(pp=&pTab->pFirstEntry; (*pp)!=pOld; pp=&((*pp)->pNext));
|
||||
*pp = (*pp)->pNext;
|
||||
if( pTab->pFirstEntry==pOld ){
|
||||
pTab->pFirstEntry = pOld->pNext;
|
||||
if( pTab->pLastEntry==pOld ) pTab->pLastEntry = 0;
|
||||
}else{
|
||||
ZipfileEntry *p;
|
||||
for(p=pTab->pFirstEntry; p; p=p->pNext){
|
||||
if( p->pNext==pOld ){
|
||||
p->pNext = pOld->pNext;
|
||||
if( pTab->pLastEntry==pOld ) pTab->pLastEntry = p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
zipfileEntryFree(pOld);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user