summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2008-01-14 14:56:09 +0000
committerAlexander Larsson <alexl@src.gnome.org>2008-01-14 14:56:09 +0000
commit40b929f565ed9a974f093931700d0b3b26c8abc5 (patch)
tree27dfa8924c328a2ab7c861986c49a37c57f7ab07
parent880ae669519292fce5e79fce049685f19e04cae4 (diff)
downloadgvfs-40b929f565ed9a974f093931700d0b3b26c8abc5.tar.gz
Handle root correctly in g_file_get_relative_path (#508719)
2008-01-14 Alexander Larsson <alexl@redhat.com> * client/gdaemonfile.c: (match_prefix): Handle root correctly in g_file_get_relative_path (#508719) svn path=/trunk/; revision=1123
-rw-r--r--ChangeLog6
-rw-r--r--client/gdaemonfile.c8
2 files changed, 14 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index da055c30..c2b04440 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2008-01-14 Alexander Larsson <alexl@redhat.com>
+ * client/gdaemonfile.c:
+ (match_prefix):
+ Handle root correctly in g_file_get_relative_path (#508719)
+
+2008-01-14 Alexander Larsson <alexl@redhat.com>
+
* daemon/gvfsdaemon.c:
Don't translate g_warning strings
diff --git a/client/gdaemonfile.c b/client/gdaemonfile.c
index 6dd56ca9..88e81ec2 100644
--- a/client/gdaemonfile.c
+++ b/client/gdaemonfile.c
@@ -332,6 +332,14 @@ match_prefix (const char *path, const char *prefix)
prefix_len = strlen (prefix);
if (strncmp (path, prefix, prefix_len) != 0)
return NULL;
+
+ /* Handle the case where prefix is the root, so that
+ * the IS_DIR_SEPRARATOR check below works */
+ if (prefix_len > 0 &&
+ prefix[prefix_len-1] == '/')
+ prefix_len--;
+
+
return path + prefix_len;
}