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