summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Cameron <brian.cameron@sun.com>2008-04-28 21:23:10 +0000
committerBrian Cameron <bcameron@src.gnome.org>2008-04-28 21:23:10 +0000
commit66d1178fa0e52d6e71620404e130e713bccf1dde (patch)
tree67eb1c50b3dd61294f72b0b0f5de5693120227f9
parentc8cee0ee8ea733d87484fe602aad3e35aad2b7da (diff)
downloadgdm-66d1178fa0e52d6e71620404e130e713bccf1dde.tar.gz
Fix reading of user's .dmrc file so that if it does not exist, we avoid
2008-04-24 Brian Cameron <brian.cameron@sun.com> * daemon/gdm-daemon-config.c: Fix reading of user's .dmrc file so that if it does not exist, we avoid calling gkeyfile functions. This avoids useless gkeyfile warning messages about the file being NULL. The fix on 2007-09-20 mostly fixed this issue by making sure the file is created before trying to read it. However, in some cases, such as when the user's $HOME directory is not writable, the read can happen when the file does not exist. svn path=/branches/gnome-2-20/; revision=6176
-rw-r--r--ChangeLog11
-rw-r--r--daemon/gdm-daemon-config.c70
2 files changed, 51 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index 9097d30e..95315ffe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2008-04-24 Brian Cameron <brian.cameron@sun.com>
+ * daemon/gdm-daemon-config.c: Fix reading of user's .dmrc
+ file so that if it does not exist, we avoid calling
+ gkeyfile functions. This avoids useless gkeyfile warning
+ messages about the file being NULL. The fix on 2007-09-20
+ mostly fixed this issue by making sure the file is
+ created before trying to read it. However, in some cases,
+ such as when the user's $HOME directory is not writable,
+ the read can happen when the file does not exist.
+
+2008-04-24 Brian Cameron <brian.cameron@sun.com>
+
* configure.ac: Add openbsd section to configure file.
to specify default halt, reboot, suspend commands.
diff --git a/daemon/gdm-daemon-config.c b/daemon/gdm-daemon-config.c
index 514ba052..0b3c92dc 100644
--- a/daemon/gdm-daemon-config.c
+++ b/daemon/gdm-daemon-config.c
@@ -2867,7 +2867,7 @@ gdm_daemon_config_set_user_session_lang (gboolean savesess,
dmrc = gdm_common_config_load (cfgstr, NULL);
if (dmrc == NULL) {
gint fd = -1;
- gdm_debug ("file: %s does not exist - creating it", cfgstr);
+ gdm_debug ("The user dmrc file %s does not exist - creating it", cfgstr);
VE_IGNORE_EINTR (fd = g_open (cfgstr,
O_CREAT | O_TRUNC | O_RDWR, 0644));
@@ -2879,7 +2879,7 @@ gdm_daemon_config_set_user_session_lang (gboolean savesess,
dmrc = gdm_common_config_load (cfgstr, NULL);
if (dmrc == NULL) {
- gdm_debug ("failed to open %s after creating it", cfgstr);
+ gdm_debug ("Failed to open dmrc file %s after trying to create it", cfgstr);
return;
}
}
@@ -2890,8 +2890,10 @@ gdm_daemon_config_set_user_session_lang (gboolean savesess,
if (savelang) {
if (ve_string_empty (save_language)) {
- /* we chose the system default language so wipe the
- * lang key */
+ /*
+ * We chose the system default language so wipe the
+ * lang key
+ */
g_key_file_remove_key (dmrc, "Desktop", "Language", NULL);
} else {
g_key_file_set_string (dmrc, "Desktop", "Language", save_language);
@@ -2926,41 +2928,49 @@ gdm_daemon_config_get_user_session_lang (char **usrsess,
cfg = gdm_common_config_load (cfgfile, NULL);
g_free (cfgfile);
- save = FALSE;
+ save = FALSE;
session = NULL;
- lang = NULL;
+ lang = NULL;
- gdm_common_config_get_string (cfg, "Desktop/Session", &session, NULL);
- if (session == NULL) {
+ if (cfg == NULL) {
session = g_strdup ("");
- }
+ lang = g_strdup ("");
+ } else {
+ gdm_common_config_get_string (cfg, "Desktop/Session", &session, NULL);
+ if (session == NULL) {
+ session = g_strdup ("");
+ }
- /* this is just being truly anal about what users give us, and in case
- * it looks like they may have included a path whack it. */
- p = strrchr (session, '/');
- if (p != NULL) {
- char *tmp = g_strdup (p + 1);
- g_free (session);
- session = tmp;
- }
+ /*
+ * This is just being truly anal about what users give us, and in case
+ * it looks like they may have included a path whack it.
+ */
+ p = strrchr (session, '/');
+ if (p != NULL) {
+ char *tmp = g_strdup (p + 1);
+ g_free (session);
+ session = tmp;
+ }
- /* ugly workaround for migration */
- if (strcmp (session, "Default") == 0 ||
- strcmp (session, "Default.desktop") == 0) {
- g_free (session);
- session = g_strdup ("default");
- save = TRUE;
- }
+ /* Ugly workaround for migration */
+ if (strcmp (session, "Default") == 0 ||
+ strcmp (session, "Default.desktop") == 0) {
+ g_free (session);
+ session = g_strdup ("default");
+ save = TRUE;
+ }
+
+ gdm_common_config_get_string (cfg, "Desktop/Language", &lang, NULL);
+ if (lang == NULL) {
+ lang = g_strdup ("");
+ }
- gdm_common_config_get_string (cfg, "Desktop/Language", &lang, NULL);
- if (lang == NULL) {
- lang = g_strdup ("");
+ g_key_file_free (cfg);
}
if (usrsess != NULL) {
*usrsess = g_strdup (session);
}
- g_free (session);
if (savesess != NULL) {
*savesess = save;
@@ -2969,7 +2979,7 @@ gdm_daemon_config_get_user_session_lang (char **usrsess,
if (usrlang != NULL) {
*usrlang = g_strdup (lang);
}
- g_free (lang);
- g_key_file_free (cfg);
+ g_free (session);
+ g_free (lang);
}