summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--metadata/metatree.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/metadata/metatree.c b/metadata/metatree.c
index 36abb9b3..4a0e5f5d 100644
--- a/metadata/metatree.c
+++ b/metadata/metatree.c
@@ -158,6 +158,7 @@ struct _MetaTree {
int fd;
char *data;
gsize len;
+ ino_t inode;
guint32 tag;
gint64 time_t_base;
@@ -469,6 +470,7 @@ meta_tree_init (MetaTree *tree)
tree->fd = fd;
tree->len = statbuf.st_size;
+ tree->inode = statbuf.st_ino;
tree->data = data;
tree->header = (MetaFileHeader *)data;
@@ -614,12 +616,24 @@ meta_tree_unref (MetaTree *tree)
static gboolean
meta_tree_needs_rereading (MetaTree *tree)
{
+ struct stat statbuf;
+
if (tree->fd == -1)
return TRUE;
if (tree->header != NULL &&
GUINT32_FROM_BE (tree->header->rotated) == 0)
return FALSE; /* Got a valid tree and its not rotated */
+
+ /* Sanity check to avoid infinite loops when a stable file
+ has the rotated bit set to 1 (see gnome bugzilla bug #600057) */
+
+ if (lstat (tree->filename, &statbuf) != 0)
+ return FALSE;
+
+ if (tree->inode == statbuf.st_ino)
+ return FALSE;
+
return TRUE;
}