From 322045a8025be30c4fb2c65cfa54fc1176d9ee95 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 2 Oct 2015 16:51:59 +0100 Subject: [PATCH] Assume that DBUS_DATADIR is absolute on Windows Both build systems arrange for this to be the case, and we already assume that it's absolute on Unix. On Windows, it's probably going to be /mingw/share or something; it gets relocated via _dbus_replace_install_prefix() at runtime. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=83539 --- bus/config-parser.c | 14 +++++--------- dbus/dbus-sysdeps-util-win.c | 18 ++---------------- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/bus/config-parser.c b/bus/config-parser.c index a0fc47c..15ce8ff 100644 --- a/bus/config-parser.c +++ b/bus/config-parser.c @@ -3413,17 +3413,13 @@ test_default_session_servicedirs (void) DBusString install_root_based; if (!_dbus_string_init (&install_root_based) || - !_dbus_get_install_root (&install_root_based)) - _dbus_assert_not_reached ("OOM getting install root"); + !_dbus_string_append (&install_root_based, DBUS_DATADIR) || + !_dbus_replace_install_prefix (&install_root_based)) + _dbus_assert_not_reached ("OOM getting relocated DBUS_DATADIR"); - if (_dbus_string_get_length (&install_root_based) > 0) - { - if (!_dbus_string_append (&install_root_based, DBUS_DATADIR) || - !_dbus_string_append (&install_root_based, "/dbus-1/services")) - _dbus_assert_not_reached ("OOM appending to install root"); + _dbus_assert (_dbus_path_is_absolute (&install_root_based)); - test_session_service_dir_matches[0] = _dbus_string_get_const_data (&install_root_based); - } + test_session_service_dir_matches[0] = _dbus_string_get_const_data (&install_root_based); #endif diff --git a/dbus/dbus-sysdeps-util-win.c b/dbus/dbus-sysdeps-util-win.c index 71296fa..d38f02b 100644 --- a/dbus/dbus-sysdeps-util-win.c +++ b/dbus/dbus-sysdeps-util-win.c @@ -1574,16 +1574,14 @@ _dbus_get_standard_session_servicedirs (DBusList **dirs) } } #else -/* - the code for accessing services requires absolute base pathes - in case DBUS_DATADIR is relative make it absolute -*/ { DBusString p; if (!_dbus_string_init (&p)) goto oom; + /* DBUS_DATADIR is assumed to be absolute; the build systems should + * ensure that. */ if (!_dbus_string_append (&p, DBUS_DATADIR) || !_dbus_replace_install_prefix (&p)) { @@ -1591,18 +1589,6 @@ _dbus_get_standard_session_servicedirs (DBusList **dirs) goto oom; } - if (!_dbus_path_is_absolute (&p)) - { - /* this only works because this is the first thing in the - * servicedir_path; if it wasn't, we'd have to use a temporary - * string and copy it in */ - if (!_dbus_get_install_root (&servicedir_path)) - { - _dbus_string_free (&p); - goto oom; - } - } - if (!_dbus_string_append (&servicedir_path, _dbus_string_get_const_data (&p))) { -- 2.6.0