|
|
92be15 |
From b0895e1998ebc83ab030ec0f17c0685439f5b404 Mon Sep 17 00:00:00 2001
|
|
|
92be15 |
From: Ray Strode <rstrode@redhat.com>
|
|
|
92be15 |
Date: Mon, 15 Apr 2013 09:57:34 -0400
|
|
|
92be15 |
Subject: [PATCH] dbus: Don't spew to console when unable to connect to dbus
|
|
|
92be15 |
daemon
|
|
|
92be15 |
|
|
|
92be15 |
Instead pass the error up for the caller to decide what to do.
|
|
|
92be15 |
|
|
|
92be15 |
This prevent untrappable warning messages from showing up at the
|
|
|
92be15 |
console if gconftool --makefile-install-rule is called.
|
|
|
92be15 |
---
|
|
|
92be15 |
gconf/gconf-dbus.c | 24 ++++++++++++------------
|
|
|
92be15 |
1 file changed, 12 insertions(+), 12 deletions(-)
|
|
|
92be15 |
|
|
|
92be15 |
diff --git a/gconf/gconf-dbus.c b/gconf/gconf-dbus.c
|
|
|
92be15 |
index 5610fcf..048e3ea 100644
|
|
|
92be15 |
--- a/gconf/gconf-dbus.c
|
|
|
92be15 |
+++ b/gconf/gconf-dbus.c
|
|
|
92be15 |
@@ -104,9 +104,9 @@ static GConfEngine *default_engine = NULL;
|
|
|
92be15 |
static GHashTable *engines_by_db = NULL;
|
|
|
92be15 |
static GHashTable *engines_by_address = NULL;
|
|
|
92be15 |
static gboolean dbus_disconnected = FALSE;
|
|
|
92be15 |
|
|
|
92be15 |
-static gboolean ensure_dbus_connection (void);
|
|
|
92be15 |
+static gboolean ensure_dbus_connection (GError **error);
|
|
|
92be15 |
static gboolean ensure_service (gboolean start_if_not_found,
|
|
|
92be15 |
GError **err);
|
|
|
92be15 |
static gboolean ensure_database (GConfEngine *conf,
|
|
|
92be15 |
gboolean start_if_not_found,
|
|
|
92be15 |
@@ -382,18 +382,20 @@ gconf_engine_detach (GConfEngine *conf)
|
|
|
92be15 |
}
|
|
|
92be15 |
}
|
|
|
92be15 |
|
|
|
92be15 |
static gboolean
|
|
|
92be15 |
-ensure_dbus_connection (void)
|
|
|
92be15 |
+ensure_dbus_connection (GError **err)
|
|
|
92be15 |
{
|
|
|
92be15 |
DBusError error;
|
|
|
92be15 |
|
|
|
92be15 |
if (global_conn != NULL)
|
|
|
92be15 |
return TRUE;
|
|
|
92be15 |
|
|
|
92be15 |
if (dbus_disconnected)
|
|
|
92be15 |
{
|
|
|
92be15 |
- g_warning ("The connection to DBus was broken. Can't reinitialize it.");
|
|
|
92be15 |
+ g_set_error (err, GCONF_ERROR,
|
|
|
92be15 |
+ GCONF_ERROR_NO_SERVER,
|
|
|
92be15 |
+ "The connection to DBus was broken. Can't reinitialize it.");
|
|
|
92be15 |
return FALSE;
|
|
|
92be15 |
}
|
|
|
92be15 |
|
|
|
92be15 |
dbus_error_init (&error);
|
|
|
92be15 |
@@ -401,9 +403,12 @@ ensure_dbus_connection (void)
|
|
|
92be15 |
global_conn = dbus_bus_get_private (DBUS_BUS_SESSION, &error);
|
|
|
92be15 |
|
|
|
92be15 |
if (!global_conn)
|
|
|
92be15 |
{
|
|
|
92be15 |
- g_warning ("Client failed to connect to the D-BUS daemon:\n%s", error.message);
|
|
|
92be15 |
+ g_set_error (err, GCONF_ERROR,
|
|
|
92be15 |
+ GCONF_ERROR_NO_SERVER,
|
|
|
92be15 |
+ "Client failed to connect to the D-BUS daemon:\n%s",
|
|
|
92be15 |
+ error.message);
|
|
|
92be15 |
|
|
|
92be15 |
dbus_error_free (&error);
|
|
|
92be15 |
return FALSE;
|
|
|
92be15 |
}
|
|
|
92be15 |
@@ -430,15 +435,10 @@ ensure_service (gboolean start_if_not_found,
|
|
|
92be15 |
DBusError error;
|
|
|
92be15 |
|
|
|
92be15 |
if (global_conn == NULL)
|
|
|
92be15 |
{
|
|
|
92be15 |
- if (!ensure_dbus_connection ())
|
|
|
92be15 |
- {
|
|
|
92be15 |
- g_set_error (err, GCONF_ERROR,
|
|
|
92be15 |
- GCONF_ERROR_NO_SERVER,
|
|
|
92be15 |
- _("No D-BUS daemon running\n"));
|
|
|
92be15 |
- return FALSE;
|
|
|
92be15 |
- }
|
|
|
92be15 |
+ if (!ensure_dbus_connection (err))
|
|
|
92be15 |
+ return FALSE;
|
|
|
92be15 |
|
|
|
92be15 |
g_assert (global_conn != NULL);
|
|
|
92be15 |
}
|
|
|
92be15 |
|
|
|
92be15 |
@@ -2511,9 +2511,9 @@ gboolean
|
|
|
92be15 |
gconf_ping_daemon (void)
|
|
|
92be15 |
{
|
|
|
92be15 |
if (global_conn == NULL)
|
|
|
92be15 |
{
|
|
|
92be15 |
- if (!ensure_dbus_connection ())
|
|
|
92be15 |
+ if (!ensure_dbus_connection (NULL))
|
|
|
92be15 |
{
|
|
|
92be15 |
return FALSE;
|
|
|
92be15 |
}
|
|
|
92be15 |
g_assert (global_conn != NULL);
|
|
|
92be15 |
--
|
|
|
92be15 |
1.8.1.4
|
|
|
92be15 |
|