From f61aa6b19cefdd94f2605c565ed451dbc2788936 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Fri, 12 Mar 2004 07:58:20 +0000 Subject: when we check the evolution dir exists, check the evolution dir exists, 2004-03-12 Not Zed * e-shell.c (detect_version): when we check the evolution dir exists, check the evolution dir exists, not the config.xmldb file. Move filename building/usage into the else condition so it can't happen again. Fixes #53277. svn path=/trunk/; revision=25040 --- shell/ChangeLog | 7 +++++++ shell/e-shell.c | 14 +++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index de019dd64e..8e1e4ad648 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,10 @@ +2004-03-12 Not Zed + + * e-shell.c (detect_version): when we check the evolution dir + exists, check the evolution dir exists, not the config.xmldb file. + Move filename building/usage into the else condition so it can't + happen again. Fixes #53277. + 2004-03-10 Bill Zhu * e-shell-startup-wizzard.c (key_press_event_callback): Used the stock diff --git a/shell/e-shell.c b/shell/e-shell.c index 18909bd0ff..8068d0a145 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -473,18 +473,17 @@ e_shell_init (EShell *shell) static gboolean detect_version (GConfClient *gconf, int *major, int *minor, int *revision) { - char *val, *evolution_dir, *filename; + char *val, *evolution_dir; struct stat st; evolution_dir = g_build_filename (g_get_home_dir (), "evolution", NULL); - filename = g_build_filename (evolution_dir, "config.xmldb", NULL); val = gconf_client_get_string(gconf, "/apps/evolution/version", NULL); if (val) { /* Since 1.4.0 We've been keeping the version key in gconf */ sscanf(val, "%u.%u.%u", major, minor, revision); g_free(val); - } else if (lstat (filename, &st) != 0 || !S_ISDIR (st.st_mode)) { + } else if (lstat (evolution_dir, &st) != 0 || !S_ISDIR (st.st_mode)) { /* If ~/evolution does not exit or is not a directory it must be a new installation */ *major = 0; *minor = 0; @@ -493,10 +492,12 @@ detect_version (GConfClient *gconf, int *major, int *minor, int *revision) xmlDocPtr config_doc = NULL; xmlNodePtr source; char *tmp; - - if (lstat(filename, &st) == 0 + + tmp = g_build_filename (evolution_dir, "config.xmldb", NULL); + if (lstat(tmp, &st) == 0 && S_ISREG(st.st_mode)) - config_doc = xmlParseFile (filename); + config_doc = xmlParseFile (tmp); + g_free (tmp); tmp = NULL; if (config_doc @@ -518,7 +519,6 @@ detect_version (GConfClient *gconf, int *major, int *minor, int *revision) } g_free (evolution_dir); - g_free (filename); return TRUE; } -- cgit v1.2.3