~jm-leddy/ubuntu/oneiric/gvfs/fix-899858

« back to all changes in this revision

Viewing changes to metadata/metatree.c

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Henriksson
  • Date: 2009-12-14 21:45:30 UTC
  • mto: (33.7.1 sid) (1.3.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 157.
  • Revision ID: james.westby@ubuntu.com-20091214214530-mbzl75p7ck29rcya
Tags: upstream-1.4.3
ImportĀ upstreamĀ versionĀ 1.4.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
158
158
  int fd;
159
159
  char *data;
160
160
  gsize len;
 
161
  ino_t inode;
161
162
 
162
163
  guint32 tag;
163
164
  gint64 time_t_base;
469
470
 
470
471
  tree->fd = fd;
471
472
  tree->len = statbuf.st_size;
 
473
  tree->inode = statbuf.st_ino;
472
474
  tree->data = data;
473
475
  tree->header = (MetaFileHeader *)data;
474
476
 
614
616
static gboolean
615
617
meta_tree_needs_rereading (MetaTree *tree)
616
618
{
 
619
  struct stat statbuf;
 
620
 
617
621
  if (tree->fd == -1)
618
622
    return TRUE;
619
623
 
620
624
  if (tree->header != NULL &&
621
625
      GUINT32_FROM_BE (tree->header->rotated) == 0)
622
626
    return FALSE; /* Got a valid tree and its not rotated */
 
627
 
 
628
  /* Sanity check to avoid infinite loops when a stable file
 
629
     has the rotated bit set to 1 (see gnome bugzilla bug #600057) */
 
630
 
 
631
  if (lstat (tree->filename, &statbuf) != 0)
 
632
    return FALSE;
 
633
 
 
634
  if (tree->inode == statbuf.st_ino)
 
635
    return FALSE;
 
636
 
623
637
  return TRUE;
624
638
}
625
639
 
1643
1657
      num_strings = GUINT32_FROM_BE (stringv->num_strings);
1644
1658
      res = g_new (char *, num_strings + 1);
1645
1659
      for (i = 0; i < num_strings; i++)
1646
 
        res[i] = verify_string (tree, stringv->strings[i]);
 
1660
        res[i] = g_strdup (verify_string (tree, stringv->strings[i]));
1647
1661
      res[i] = NULL;
1648
1662
    }
1649
1663