From 4d4156db1b333e35f3e8c800aa4d4d0a0d6e2248 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 1 Dec 2005 04:32:52 +0000 Subject: [PATCH] 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. --- glib/gstdio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/glib/gstdio.c b/glib/gstdio.c index aa4a9e44f..fe75643b3 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);