Blame SOURCES/drop-spew.patch

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