glib r7958 - trunk/gio



Author: alexl
Date: Wed Mar  4 13:47:53 2009
New Revision: 7958
URL: http://svn.gnome.org/viewvc/glib?rev=7958&view=rev

Log:
2009-03-04  Alexander Larsson  <alexl redhat com>

	Bug 573843 â g_get_current_dir returns non-absolute path

	* glocalfile.c (canonicalize_filename):
	Handle the case where g_get_current_dir() returns a non-absolute path.



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

Modified: trunk/gio/glocalfile.c
==============================================================================
--- trunk/gio/glocalfile.c	(original)
+++ trunk/gio/glocalfile.c	Wed Mar  4 13:47:53 2009
@@ -244,6 +244,15 @@
 
   start = (char *)g_path_skip_root (canon);
 
+  if (start == NULL)
+    {
+      /* This shouldn't really happen, as g_get_current_dir() should
+	 return an absolute pathname, but bug 573843 shows this is
+	 not always happening */
+      g_free (canon);
+      return g_build_filename (G_DIR_SEPARATOR_S, filename, NULL);
+    }
+  
   /* POSIX allows double slashes at the start to
    * mean something special (as does windows too).
    * So, "//" != "/", but more than two slashes



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