Upstream patch

From 2418840248f07025ad0edc96ed17e03ce5e47f3e Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 21 Dec 2009 11:14:54 -0500
Subject: [PATCH 2/2] Don't take bus name until ready

Previously, we would take a bus name right away, but
not register the manager object until later.  This
causes a race when being activated by a method call
on the manager object, where ConsoleKit gets started
but the method call fails.

https://bugs.freedesktop.org/show_bug.cgi?id=25744
---
 src/main.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/main.c b/src/main.c
index 809c6d6..b8f698f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -294,11 +294,19 @@ main (int    argc,
 
         setup_debug_log (debug);
 
+        g_debug ("initializing console-kit-daemon %s", VERSION);
+
         connection = get_system_bus ();
         if (connection == NULL) {
                 goto out;
         }
 
+        manager = ck_manager_new ();
+
+        if (manager == NULL) {
+                goto out;
+        }
+
         bus_proxy = get_bus_proxy (connection);
         if (bus_proxy == NULL) {
                 g_warning ("Could not construct bus_proxy object; bailing out");
@@ -310,16 +318,8 @@ main (int    argc,
                 goto out;
         }
 
-        g_debug ("initializing console-kit-daemon %s", VERSION);
-
         create_pid_file ();
 
-        manager = ck_manager_new ();
-
-        if (manager == NULL) {
-                goto out;
-        }
-
         loop = g_main_loop_new (NULL, FALSE);
 
         g_signal_connect (bus_proxy,
-- 
1.7.1

