glib r6305 - trunk/gio



Author: alexl
Date: Mon Jan 14 14:55:27 2008
New Revision: 6305
URL: http://svn.gnome.org/viewvc/glib?rev=6305&view=rev

Log:
2008-01-14  Alexander Larsson  <alexl redhat com>

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



Modified:
   trunk/gio/ChangeLog
   trunk/gio/glocalfile.c

Modified: trunk/gio/glocalfile.c
==============================================================================
--- trunk/gio/glocalfile.c	(original)
+++ trunk/gio/glocalfile.c	Mon Jan 14 14:55:27 2008
@@ -475,6 +475,13 @@
   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;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]