Nuke the metadata file if magic blob is wrong

Gbp-Pq: Name metadata-nuke-junk-data.patch
This commit is contained in:
Christian Kellner 2009-11-04 16:40:24 +01:00 committed by luzp
parent 079ac3cdf9
commit 70353a1032
1 changed files with 9 additions and 1 deletions

View File

@ -451,7 +451,15 @@ meta_tree_init (MetaTree *tree)
if (memcmp (tree->header->magic, MAGIC, MAGIC_LEN) != 0)
{
g_warning ("can't init metadata tree %s: wrong magic", tree->filename);
goto err;
if (!tree->for_write)
goto err;
meta_tree_clear (tree);
if (g_unlink (tree->filename) != 0)
goto err;
goto retry;
}
if (tree->header->major != MAJOR_VERSION)