diff --git a/gio/ChangeLog b/gio/ChangeLog index ecb52eb2d..5a7ae0aae 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,3 +1,9 @@ +2008-01-14 Alexander Larsson + + * glocalfile.c: + (match_prefix): + Handle root correctly in g_file_get_relative_path (#508719) + 2008-01-14 Alexander Larsson * gasyncresult.c: diff --git a/gio/glocalfile.c b/gio/glocalfile.c index 35ad6ed79..1de3e485d 100644 --- a/gio/glocalfile.c +++ b/gio/glocalfile.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; }