[PATCH] Daemonize consolekit only after it is registered on D-Bus

Olivier Blin blino at mandriva.com
Wed Oct 1 15:46:51 PDT 2008


This patch moves the daemonize call only after consolekit is properly
registered on D-Bus, to avoid race conditions.
It somehow reverts commit f073826f58541cbbe2b805f200a9d245d76c634c

Signed-off-by: Olivier Blin <blino at mandriva.com>
---
 src/main.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main.c b/src/main.c
index 809c6d6..096676f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -288,10 +288,6 @@ main (int    argc,
                 goto out;
         }
 
-        if (! no_daemon && daemon (0, 0)) {
-                g_error ("Could not daemonize: %s", g_strerror (errno));
-        }
-
         setup_debug_log (debug);
 
         connection = get_system_bus ();
@@ -331,6 +327,10 @@ main (int    argc,
                 g_timeout_add (1000 * 30, (GSourceFunc) timed_exit_cb, loop);
         }
 
+        if (! no_daemon && daemon (0, 0)) {
+                g_error ("Could not daemonize: %s", g_strerror (errno));
+        }
+
         g_main_loop_run (loop);
 
         if (manager != NULL) {
-- 
1.6.0.2



More information about the hal mailing list