From: Tor Lillqvist Date: Thu, 1 Dec 2005 04:32:52 +0000 (+0000) Subject: Don't call g_path_skip_root() unless the path is absolute. X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=4d4156db1b333e35f3e8c800aa4d4d0a0d6e2248;p=dana%2Fcg-glib.git Don't call g_path_skip_root() unless the path is absolute. 2005-12-01 Tor Lillqvist * glib/gstdio.c (g_stat): Don't call g_path_skip_root() unless the path is absolute. --- diff --git a/glib/gstdio.c b/glib/gstdio.c index aa4a9e44..fe75643b 100644 --- a/glib/gstdio.c +++ b/glib/gstdio.c @@ -599,7 +599,8 @@ g_stat (const gchar *filename, len = wcslen (wfilename); while (len > 0 && G_IS_DIR_SEPARATOR (wfilename[len-1])) len--; - if (len > g_path_skip_root (filename) - filename) + if (len > 0 && + (!g_path_is_absolute (filename) || len > g_path_skip_root (filename) - filename)) wfilename[len] = '\0'; retval = _wstat (wfilename, (struct _stat *) buf); @@ -626,7 +627,8 @@ g_stat (const gchar *filename, len = strlen (cp_filename); while (len > 0 && G_IS_DIR_SEPARATOR (cp_filename[len-1])) len--; - if (len > g_path_skip_root (filename) - filename) + if (len > 0 && + (!g_path_is_absolute (filename) || len > g_path_skip_root (filename) - filename)) cp_filename[len] = '\0'; retval = stat (cp_filename, buf);