Handle root correctly in g_file_get_relative_path (#508719)

2008-01-14  Alexander Larsson  <alexl@redhat.com>

        * glocalfile.c:
        (match_prefix):
	Handle root correctly in g_file_get_relative_path (#508719)


svn path=/trunk/; revision=6305
This commit is contained in:
Alexander Larsson 2008-01-14 14:55:27 +00:00 committed by Alexander Larsson
parent f879f67a81
commit a80b1120f1
2 changed files with 13 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2008-01-14 Alexander Larsson <alexl@redhat.com>
* glocalfile.c:
(match_prefix):
Handle root correctly in g_file_get_relative_path (#508719)
2008-01-14 Alexander Larsson <alexl@redhat.com>
* gasyncresult.c:

View File

@ -475,6 +475,13 @@ match_prefix (const char *path,
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 &&
G_IS_DIR_SEPARATOR (prefix[prefix_len-1]))
prefix_len--;
return path + prefix_len;
}