From 70a276eca32744525f06edc09e77aed07276abca Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 4 Mar 2009 13:47:53 +0000 Subject: [PATCH] =?utf8?q?Bug=20573843=20=E2=80=93=20g=5Fget=5Fcurrent=5Fd?= =?utf8?q?ir=20returns=20non-absolute=20path?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2009-03-04 Alexander Larsson 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. svn path=/trunk/; revision=7958 --- gio/ChangeLog | 7 +++++++ gio/glocalfile.c | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/gio/ChangeLog b/gio/ChangeLog index 6df6bc2..1417f65 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,5 +1,12 @@ 2009-03-04 Alexander Larsson + 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. + +2009-03-04 Alexander Larsson + Bug 573970 – crash in gunixvolumemonitor:update_mounts when unmounting * gunionvolumemonitor.c: diff --git a/gio/glocalfile.c b/gio/glocalfile.c index 217ee98..b1d7353 100644 --- a/gio/glocalfile.c +++ b/gio/glocalfile.c @@ -244,6 +244,15 @@ canonicalize_filename (const char *filename) 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 -- 2.7.4