1*4882a593SmuzhiyunFixes errors such as this in the rootfs generation: 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun(gconftool-2.real:10095): GConf-WARNING **: Client failed to connect to the D-BUS daemon: 4*4882a593SmuzhiyunUsing X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead 5*4882a593Smuzhiyun 6*4882a593SmuzhiyunUpstream-Status: Backport 7*4882a593SmuzhiyunSigned-off-by: Ross Burton <ross.burton@intel.com> 8*4882a593Smuzhiyun 9*4882a593SmuzhiyunFrom b0895e1998ebc83ab030ec0f17c0685439f5b404 Mon Sep 17 00:00:00 2001 10*4882a593SmuzhiyunFrom: Ray Strode <rstrode@redhat.com> 11*4882a593SmuzhiyunDate: Mon, 15 Apr 2013 09:57:34 -0400 12*4882a593SmuzhiyunSubject: [PATCH] dbus: Don't spew to console when unable to connect to dbus 13*4882a593Smuzhiyun daemon 14*4882a593Smuzhiyun 15*4882a593SmuzhiyunInstead pass the error up for the caller to decide what to do. 16*4882a593Smuzhiyun 17*4882a593SmuzhiyunThis prevent untrappable warning messages from showing up at the 18*4882a593Smuzhiyunconsole if gconftool --makefile-install-rule is called. 19*4882a593Smuzhiyun--- 20*4882a593Smuzhiyun gconf/gconf-dbus.c | 24 ++++++++++++------------ 21*4882a593Smuzhiyun 1 file changed, 12 insertions(+), 12 deletions(-) 22*4882a593Smuzhiyun 23*4882a593Smuzhiyundiff --git a/gconf/gconf-dbus.c b/gconf/gconf-dbus.c 24*4882a593Smuzhiyunindex 5610fcf..048e3ea 100644 25*4882a593Smuzhiyun--- a/gconf/gconf-dbus.c 26*4882a593Smuzhiyun+++ b/gconf/gconf-dbus.c 27*4882a593Smuzhiyun@@ -105,7 +105,7 @@ static GHashTable *engines_by_db = NULL; 28*4882a593Smuzhiyun static GHashTable *engines_by_address = NULL; 29*4882a593Smuzhiyun static gboolean dbus_disconnected = FALSE; 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun-static gboolean ensure_dbus_connection (void); 32*4882a593Smuzhiyun+static gboolean ensure_dbus_connection (GError **error); 33*4882a593Smuzhiyun static gboolean ensure_service (gboolean start_if_not_found, 34*4882a593Smuzhiyun GError **err); 35*4882a593Smuzhiyun static gboolean ensure_database (GConfEngine *conf, 36*4882a593Smuzhiyun@@ -383,7 +383,7 @@ gconf_engine_detach (GConfEngine *conf) 37*4882a593Smuzhiyun } 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun static gboolean 40*4882a593Smuzhiyun-ensure_dbus_connection (void) 41*4882a593Smuzhiyun+ensure_dbus_connection (GError **err) 42*4882a593Smuzhiyun { 43*4882a593Smuzhiyun DBusError error; 44*4882a593Smuzhiyun 45*4882a593Smuzhiyun@@ -392,7 +392,9 @@ ensure_dbus_connection (void) 46*4882a593Smuzhiyun 47*4882a593Smuzhiyun if (dbus_disconnected) 48*4882a593Smuzhiyun { 49*4882a593Smuzhiyun- g_warning ("The connection to DBus was broken. Can't reinitialize it."); 50*4882a593Smuzhiyun+ g_set_error (err, GCONF_ERROR, 51*4882a593Smuzhiyun+ GCONF_ERROR_NO_SERVER, 52*4882a593Smuzhiyun+ "The connection to DBus was broken. Can't reinitialize it."); 53*4882a593Smuzhiyun return FALSE; 54*4882a593Smuzhiyun } 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun@@ -402,7 +404,10 @@ ensure_dbus_connection (void) 57*4882a593Smuzhiyun 58*4882a593Smuzhiyun if (!global_conn) 59*4882a593Smuzhiyun { 60*4882a593Smuzhiyun- g_warning ("Client failed to connect to the D-BUS daemon:\n%s", error.message); 61*4882a593Smuzhiyun+ g_set_error (err, GCONF_ERROR, 62*4882a593Smuzhiyun+ GCONF_ERROR_NO_SERVER, 63*4882a593Smuzhiyun+ "Client failed to connect to the D-BUS daemon:\n%s", 64*4882a593Smuzhiyun+ error.message); 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun dbus_error_free (&error); 67*4882a593Smuzhiyun return FALSE; 68*4882a593Smuzhiyun@@ -431,13 +436,8 @@ ensure_service (gboolean start_if_not_found, 69*4882a593Smuzhiyun 70*4882a593Smuzhiyun if (global_conn == NULL) 71*4882a593Smuzhiyun { 72*4882a593Smuzhiyun- if (!ensure_dbus_connection ()) 73*4882a593Smuzhiyun- { 74*4882a593Smuzhiyun- g_set_error (err, GCONF_ERROR, 75*4882a593Smuzhiyun- GCONF_ERROR_NO_SERVER, 76*4882a593Smuzhiyun- _("No D-BUS daemon running\n")); 77*4882a593Smuzhiyun- return FALSE; 78*4882a593Smuzhiyun- } 79*4882a593Smuzhiyun+ if (!ensure_dbus_connection (err)) 80*4882a593Smuzhiyun+ return FALSE; 81*4882a593Smuzhiyun 82*4882a593Smuzhiyun g_assert (global_conn != NULL); 83*4882a593Smuzhiyun } 84*4882a593Smuzhiyun@@ -2512,7 +2512,7 @@ gconf_ping_daemon (void) 85*4882a593Smuzhiyun { 86*4882a593Smuzhiyun if (global_conn == NULL) 87*4882a593Smuzhiyun { 88*4882a593Smuzhiyun- if (!ensure_dbus_connection ()) 89*4882a593Smuzhiyun+ if (!ensure_dbus_connection (NULL)) 90*4882a593Smuzhiyun { 91*4882a593Smuzhiyun return FALSE; 92*4882a593Smuzhiyun } 93*4882a593Smuzhiyun-- 94*4882a593Smuzhiyun1.7.10.4 95*4882a593Smuzhiyun 96