[gnome-keyring] daemon: If control directory in environment use when replacing



commit 1cf271ccf8652fc63b6d63dfa80320b7e6e072c1
Author: Stef Walter <stefw gnome org>
Date:   Wed Aug 8 15:13:13 2012 +0200

    daemon: If control directory in environment use when replacing
    
     * When replacing another daemon always prefer the control
       directory discovered through the environment. This way
       ssh and gpg work with a --replace'd gnome-keyring-daemon.
     * Previously we would use the last control directory discovered
       which meant that if gnome-keyring-daemon had crashed, and had
       later been restarted via dbus, then the control directory
       for the last daemon was used, rather than the one in the env.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=681449

 daemon/gkd-main.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/daemon/gkd-main.c b/daemon/gkd-main.c
index 9da8a01..26b1f95 100644
--- a/daemon/gkd-main.c
+++ b/daemon/gkd-main.c
@@ -586,8 +586,13 @@ replace_daemon_at (const gchar *directory)
 {
 	gboolean ret;
 
-	g_free (control_directory);
-	control_directory = g_strdup (directory);
+	/*
+	 * The first control_directory is the environment one, always
+	 * prefer that since it's the one that ssh and gpg will connect to
+	 */
+	if (control_directory == NULL)
+		control_directory = g_strdup (directory);
+
 	ret = gkd_control_quit (directory, GKD_CONTROL_QUIET_IF_NO_PEER);
 
 	/*
@@ -946,7 +951,9 @@ main (int argc, char *argv[])
 	} else if (run_for_replace) {
 		discover_other_daemon (replace_daemon_at, FALSE);
 		if (control_directory)
-			g_message ("replacing daemon at: %s", control_directory);
+			g_message ("Replacing daemon, using directory: %s", control_directory);
+		else
+			g_message ("Could not find daemon to replace, staring normally");
 	}
 
 	/* Initialize the main directory */



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