diff options
author | Alexander Larsson <alexl@redhat.com> | 2008-01-14 14:56:09 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2008-01-14 14:56:09 +0000 |
commit | 40b929f565ed9a974f093931700d0b3b26c8abc5 (patch) | |
tree | 27dfa8924c328a2ab7c861986c49a37c57f7ab07 | |
parent | 880ae669519292fce5e79fce049685f19e04cae4 (diff) | |
download | gvfs-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-- | ChangeLog | 6 | ||||
-rw-r--r-- | client/gdaemonfile.c | 8 |
2 files changed, 14 insertions, 0 deletions
@@ -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; } |