summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2014-03-06 16:11:50 +0100
committerStef Walter <stefw@gnome.org>2014-03-06 18:40:24 +0100
commit924b7704010b2a61d93640b63b5089176c026fbf (patch)
tree3c13dc51f4495d9bcbd3b52a5cef608cfeb37842
parent8272724a3970cd3e8f5d32dd5e640c0119596fb0 (diff)
daemon: Don't initialize in an idle handler, this is racy
This races with things connecting over the control socket and trying to initialize the daemon
-rw-r--r--daemon/gkd-main.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/daemon/gkd-main.c b/daemon/gkd-main.c
index 15728a59..d014ddc0 100644
--- a/daemon/gkd-main.c
+++ b/daemon/gkd-main.c
@@ -811,25 +811,6 @@ on_login_timeout (gpointer data)
return FALSE;
}
-static gboolean
-on_idle_initialize (gpointer data)
-{
- gkr_daemon_initialize_steps (run_components);
-
- /*
- * Close stdout and so that the caller knows that we're
- * all initialized, (when run in foreground mode).
- *
- * However since some logging goes to stdout, redirect that
- * to stderr. We don't want the caller confusing that with
- * valid output anyway.
- */
- if (dup2 (2, 1) < 1)
- g_warning ("couldn't redirect stdout to stderr");
-
- return FALSE; /* don't run again */
-}
-
int
main (int argc, char *argv[])
{
@@ -960,8 +941,22 @@ main (int argc, char *argv[])
prepare_logging();
/* Remainder initialization after forking, if initialization not delayed */
- if (!run_for_login)
- g_idle_add (on_idle_initialize, NULL);
+ if (!run_for_login) {
+ gkr_daemon_initialize_steps (run_components);
+
+ /*
+ * Close stdout and so that the caller knows that we're
+ * all initialized, (when run in foreground mode).
+ *
+ * However since some logging goes to stdout, redirect that
+ * to stderr. We don't want the caller confusing that with
+ * valid output anyway.
+ */
+ if (dup2 (2, 1) < 1)
+ g_warning ("couldn't redirect stdout to stderr");
+
+ g_debug ("initialization complete");
+ }
g_main_loop_run (loop);