Package: gvfs / 1.30.4-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
From 1148581b7306d9e2505cbf0241809428cf6e6cc8 Mon Sep 17 00:00:00 2001
From: Christian Kellner <gicmo@gnome.org>
Date: Wed, 4 Nov 2009 16:40:24 +0100
Subject: [PATCH] Nuke the metadata file if magic blob is wrong

---
 metadata/metatree.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

--- a/metadata/metatree.c
+++ b/metadata/metatree.c
@@ -445,7 +445,15 @@
   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)