[gnome-keyring/wip/fork-fixes] daemon: Print error messages if we cannot connect to bus



commit 194412bd95e31cc87ba514458d0a8bce232a7e87
Author: Stef Walter <stefw gnome org>
Date:   Fri Oct 16 21:19:18 2015 +0200

    daemon: Print error messages if we cannot connect to bus

 daemon/gkd-main.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/daemon/gkd-main.c b/daemon/gkd-main.c
index 95a60f7..eb58dab 100644
--- a/daemon/gkd-main.c
+++ b/daemon/gkd-main.c
@@ -902,6 +902,9 @@ main (int argc, char *argv[])
         * predictable startup.
         */
 
+       GDBusConnection *connection = NULL;
+       GError *error = NULL;
+
        /*
         * Before we do ANYTHING, we drop privileges so we don't become
         * a security issue ourselves.
@@ -965,10 +968,11 @@ main (int argc, char *argv[])
                         */
                        send_environment_and_finish_parent (parent_wakeup_fd);
                        if (run_foreground) {
-                               GDBusConnection *connection;
-                               connection = g_bus_get_sync (G_BUS_TYPE_SESSION,
-                                                            NULL,
-                                                            NULL);
+                               connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+                               if (error) {
+                                       g_warning ("Couldn't connect to session bus: %s", error->message);
+                                       g_clear_error (&error);
+                               }
                                loop = g_main_loop_new (NULL, FALSE);
                                g_main_loop_run (loop);
                                g_clear_pointer (&loop, g_main_loop_unref);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]