summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2021-12-14 15:16:33 +0100
committerRalf Habacker <ralf.habacker@freenet.de>2021-12-16 09:46:46 +0100
commitdbc8f2a81862faf7178f9d10ea5e0c75e921937b (patch)
treec49a3c51562c465c440287204f8dac94858603a7
parent1f0331be72d796ba41407b347214ed4393a93f24 (diff)
downloaddbus-dbc8f2a81862faf7178f9d10ea5e0c75e921937b.tar.gz
_dbus_get_install_root_as_hash() now expects an initialized DBusString instance as a parameter
Since the _dbus_get_address_string() function is affected by the change, the code calling the mentioned function been adapted. Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
-rw-r--r--dbus/dbus-sysdeps-win.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c
index 35f6f038..9f617695 100644
--- a/dbus/dbus-sysdeps-win.c
+++ b/dbus/dbus-sysdeps-win.c
@@ -2934,10 +2934,18 @@ static const char *cDBusDaemonMutex = "DBusDaemonMutex";
// named shm for dbus adress info (per user)
static const char *cDBusDaemonAddressInfo = "DBusDaemonAddressInfo";
+/**
+ * Return the hash of the installation root directory, which can be
+ * used to construct a per-installation-root scope for autolaunching
+ *
+ * @param out initialized DBusString instance to return hash string
+ * @returns #FALSE on OOM, #TRUE if not OOM
+ */
static dbus_bool_t
_dbus_get_install_root_as_hash (DBusString *out)
{
DBusString install_path;
+ _dbus_assert (out != NULL);
_dbus_string_init (&install_path);
@@ -2945,7 +2953,6 @@ _dbus_get_install_root_as_hash (DBusString *out)
_dbus_string_get_length (&install_path) == 0)
return FALSE;
- _dbus_string_init (out);
_dbus_string_tolower_ascii (&install_path, 0, _dbus_string_get_length (&install_path));
if (!_dbus_sha_compute (&install_path, out))
@@ -2969,13 +2976,21 @@ _dbus_get_address_string (DBusString *out, const char *basestring, const char *s
|| strcmp (scope, "install-path") == 0)
{
DBusString temp;
+ dbus_bool_t retval = FALSE;
+
+ if (!_dbus_string_init (&temp))
+ return FALSE;
+
if (!_dbus_get_install_root_as_hash (&temp))
- {
- return FALSE;
- }
- _dbus_string_append (out, "-");
- _dbus_string_append (out, _dbus_string_get_const_data(&temp));
+ goto out;
+
+ if (!_dbus_string_append_printf (out, "-%s", dbus_string_get_const_data (&temp)))
+ goto out;
+
+ retval = TRUE;
+out:
_dbus_string_free (&temp);
+ return retval;
}
else if (strcmp (scope, "*user") == 0)
{