--- gnome-session-2.9.4/gnome-session/gsm-keyring.c.orig Mon Jan 10 16:48:11 2005 +++ gnome-session-2.9.4/gnome-session/gsm-keyring.c Mon Feb 28 03:59:49 2005 @@ -58,6 +58,7 @@ char *pid_str, *end; const char *old_keyring; char *argv[2]; + gchar *path, *base, *command; /* If there is already a working keyring, don't start a new daemon */ old_keyring = g_getenv ("GNOME_KEYRING_SOCKET"); @@ -68,13 +69,39 @@ /* Pipe to slave keyring lifetime to */ pipe (keyring_lifetime_pipe); + base = g_path_get_basename(GNOME_KEYRING_DAEMON); /* gets always something */ + if (g_ascii_strcasecmp(".", base)) { /* ok - this is paranoid ;-) */ + g_free(base); + base = g_strdup("esd"); + } + /* first try to get the esd in the gnome-session's dir */ + command = g_get_origin(); + if (command != NULL) { + path = g_build_filename(path, base, NULL); + if ((!g_file_test (path, G_FILE_TEST_IS_EXECUTABLE)) + || g_file_test (path, G_FILE_TEST_IS_DIR) + { + g_free(path); + path = NULL; + } + g_free(command); + } + if ( path == NULL) { + path = g_find_program_in_path(base); + if (path == NULL) { + /* if not found, use the hard coded value */ + path = g_strdup(GNOME_KEYRING_DAEMON); + } + } + g_free(base); + err = NULL; - argv[0] = GNOME_KEYRING_DAEMON; + argv[0] = path; argv[1] = NULL; g_spawn_sync (NULL, argv, NULL, G_SPAWN_LEAVE_DESCRIPTORS_OPEN, child_setup, NULL, &standard_out, NULL, &status, &err); - + g_free(path); close (keyring_lifetime_pipe[0]); /* We leave keyring_lifetime_pipe[1] open for the lifetime of the session, in order to slave the keyring daemon lifecycle to the session. */