[gnome-keyring] daemon: Don't initialize in an idle handler, this is racy
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keyring] daemon: Don't initialize in an idle handler, this is racy
- Date: Thu, 6 Mar 2014 17:48:12 +0000 (UTC)
commit 924b7704010b2a61d93640b63b5089176c026fbf
Author: Stef Walter <stefw gnome org>
Date: Thu Mar 6 16:11:50 2014 +0100
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
daemon/gkd-main.c | 37 ++++++++++++++++---------------------
1 files changed, 16 insertions(+), 21 deletions(-)
---
diff --git a/daemon/gkd-main.c b/daemon/gkd-main.c
index 15728a5..d014ddc 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]