From 2b5856814c6b2ed47b52893fc452570789943dc9 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Sun, 1 Feb 2015 18:16:52 +0100 Subject: [PATCH] Enable dbus library verbose mode on runtime using public function dbus_setenv("DBUS_VERBOSE", 0|1). --- dbus/dbus-internals.c | 11 ++++++++++- dbus/dbus-sysdeps.c | 8 ++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/dbus/dbus-internals.c b/dbus/dbus-internals.c index 92a108c..5780ea5 100644 --- a/dbus/dbus-internals.c +++ b/dbus/dbus-internals.c @@ -365,7 +365,16 @@ _dbus_is_verbose_real (void) void _dbus_set_verbose (dbus_bool_t state) { - verbose = state; + if (state) + { + verbose = state; + _dbus_verbose ("enable verbose"); + } + else + { + _dbus_verbose ("disable verbose"); + verbose = state; + } } dbus_bool_t _dbus_get_verbose (void) diff --git a/dbus/dbus-sysdeps.c b/dbus/dbus-sysdeps.c index 9979210..6c52073 100644 --- a/dbus/dbus-sysdeps.c +++ b/dbus/dbus-sysdeps.c @@ -118,6 +118,10 @@ dbus_setenv (const char *varname, if (value == NULL) { +#ifdef DBUS_ENABLE_VERBOSE_MODE + if (strcmp (varname, "DBUS_VERBOSE") == 0) + _dbus_set_verbose (FALSE); +#endif #ifdef HAVE_UNSETENV unsetenv (varname); return TRUE; @@ -145,6 +149,10 @@ dbus_setenv (const char *varname, } else { +#ifdef DBUS_ENABLE_VERBOSE_MODE + if (strcmp (varname, "DBUS_VERBOSE") == 0) + _dbus_set_verbose (*value == '1' ? TRUE : FALSE); +#endif #ifdef HAVE_SETENV return (setenv (varname, value, TRUE) == 0); #else -- 1.8.4.5