mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
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:
parent
f879f67a81
commit
a80b1120f1
@ -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:
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user