--- gnome-session-2.9.4/gnome-session/main.c.orig Mon Jan 10 17:09:07 2005 +++ gnome-session-2.9.4/gnome-session/main.c Mon Feb 28 03:36:18 2005 @@ -292,8 +292,41 @@ GError *error; char *command; int status; + gchar *base, *path; - command = g_strjoin (" ", GCONFTOOL_CMD, "--shutdown", NULL); + base = g_path_get_basename(GCONFTOOL_CMD); /* gets always something */ + if (g_ascii_strcasecmp(".", base)) { /* ok - this is paranoid ;-) */ + g_free(base); + base = g_strdup("gconftool-2"); + } + /* the usual user may not have $gnome/sbin in its path ... */ + path = g_get_origin(); + if (path != NULL) { + command = g_path_get_dirname(path); + g_free(path); + if (command[0] == '.') { + path = g_build_filename("/sbin", base, NULL); + } else { + path = g_build_filename(command, "sbin", base, NULL); + } + g_free(command); + if ((!g_file_test (path, G_FILE_TEST_IS_EXECUTABLE)) + || g_file_test (path, G_FILE_TEST_IS_DIR) + { + g_free(path); + path = NULL; + } + } + if (path == NULL) { + path = g_find_program_in_path(base); + if (path == NULL) { + /* if not found, use the hard coded value */ + path = g_strdup(GCONFTOOL_CMD); + } + } + command = g_strjoin (" ", path, "--shutdown", NULL); + g_free(base); + g_free(path); status = 0; error = NULL; @@ -324,6 +357,7 @@ gboolean a_t_support; GError *err; int status; + gchar *command, *base, *path; if (getenv ("GSM_VERBOSE_DEBUG")) gsm_set_verbose (TRUE); @@ -355,7 +389,42 @@ gnome_login_check (); err = NULL; - g_spawn_command_line_sync (GCONF_SANITY_CHECK, NULL, NULL, &status, &err); + base = g_path_get_basename(GCONF_SANITY_CHECK); /* gets always something */ + if (g_ascii_strcasecmp(".", base)) { /* ok - this is paranoid ;-) */ + g_free(base); + base = g_strdup("gconf-sanity-check-2"); + } + /* the usual user may not have $gnome/sbin in its path ... */ + path = g_get_origin(); + if (path != NULL) { + command = g_path_get_dirname(path); + g_free(path); + if (command[0] == '.') { + path = g_build_filename("/sbin", base, NULL); + } else { + path = g_build_filename(command, "sbin", base, NULL); + } + g_free(command); + if ((!g_file_test (path, G_FILE_TEST_IS_EXECUTABLE)) + || g_file_test (path, G_FILE_TEST_IS_DIR) + { + g_free(path); + path = NULL; + } + } + if (path == NULL) { + path = g_find_program_in_path(base); + if (path == NULL) { + /* if not found, use the hard coded value */ + path = g_strdup(GCONF_SANITY_CHECK); + } + } + + g_free(base); + + + g_spawn_command_line_sync (path, NULL, NULL, &status, &err); + g_free(path); if (err != NULL) { g_printerr ("Failed to run gconf-sanity-check-2: %s\n",