[gvfs] Handle looking up MetaTree for /
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Subject: [gvfs] Handle looking up MetaTree for /
- Date: Tue, 23 Jun 2009 11:10:38 -0400 (EDT)
commit 81332679aad651f6319913ebf39253aecb2f8403
Author: Alexander Larsson <alexl redhat com>
Date: Sat Jun 20 20:52:45 2009 +0200
Handle looking up MetaTree for /
The assert failed because / is special cased in expand_parents,
special case it in find_mountpoint_for too.
metadata/metatree.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/metadata/metatree.c b/metadata/metatree.c
index e2d04b8..e24488c 100644
--- a/metadata/metatree.c
+++ b/metadata/metatree.c
@@ -1851,7 +1851,10 @@ get_dirname (const char *path)
parent = g_path_get_dirname (path);
if (strcmp (parent, ".") == 0 ||
strcmp (parent, path) == 0)
- return NULL;
+ {
+ g_free (parent);
+ return NULL;
+ }
return parent;
}
@@ -2223,6 +2226,11 @@ find_mountpoint_for (MetaLookupCache *cache,
char *extra_prefix;
first_dir = get_dirname (file);
+ if (first_dir == NULL)
+ {
+ *prefix_out = g_strdup ("/");
+ return "/";
+ }
g_assert (cache->last_parent_expanded != NULL);
g_assert (strcmp (cache->last_parent_expanded, first_dir) == 0);
@@ -2349,13 +2357,9 @@ expand_parents (MetaLookupCache *cache,
char *path_copy;
path_copy = canonicalize_filename (path);
- parent = g_path_get_dirname (path_copy);
- if (strcmp (parent, ".") == 0 ||
- strcmp (parent, path_copy) == 0)
- {
- g_free (parent);
- return path_copy;
- }
+ parent = get_dirname (path_copy);
+ if (parent == NULL)
+ return path_copy;
if (cache->last_parent == NULL ||
strcmp (cache->last_parent, parent) != 0)
@@ -2448,6 +2452,8 @@ meta_lookup_cache_lookup_path (MetaLookupCache *cache,
}
found:
+ g_print ("Fount treename %s, prefix: %s\n",
+ treename, prefix);
tree = meta_tree_lookup_by_name (treename, for_write);
if (tree)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]