Package: gvfs / 1.46.2-1

metadata-nuke-junk-data.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From: Christian Kellner <gicmo@gnome.org>
Date: Wed, 4 Nov 2009 16:40:24 +0100
Subject: Nuke the metadata file if magic blob is wrong

---
 metadata/metatree.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/metadata/metatree.c b/metadata/metatree.c
index 0c11ddc..fa7697d 100644
--- a/metadata/metatree.c
+++ b/metadata/metatree.c
@@ -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)