* fix infinite loop in mu-cmd-index (fixes issue #36) + some cosmetics

This commit is contained in:
Dirk-Jan C. Binnema 2011-04-24 16:03:40 +03:00
parent 3b3dc10b67
commit 8f9bd404cf
3 changed files with 12 additions and 10 deletions

View File

@ -107,7 +107,7 @@ static gboolean
check_maildir (const char *maildir)
{
if (!maildir) {
g_warning ("no maildir to work on");
g_warning ("no maildir to work on; use --maildir= to set it explicitly");
return FALSE;
}
@ -220,7 +220,7 @@ update_maildir_path_maybe (MuIndex *idx, MuConfig *opts)
/* if 'maildir_guessed' is TRUE, we can override it later
* with mu_index_last_used_maildir (in mu-cmd-index.c)
*/
while (!opts->maildir) {
if (!opts->maildir) {
const char *tmp;
@ -230,13 +230,15 @@ update_maildir_path_maybe (MuIndex *idx, MuConfig *opts)
opts->maildir = g_strdup (tmp);
else
opts->maildir = mu_util_guess_maildir ();
}
exp = mu_util_dir_expand(opts->maildir);
if (exp) {
g_free(opts->maildir);
opts->maildir = exp;
}
if (opts->maildir) {
exp = mu_util_dir_expand(opts->maildir);
if (exp) {
g_free(opts->maildir);
opts->maildir = exp;
}
}
return check_maildir (opts->maildir);
}

View File

@ -201,7 +201,7 @@ init_paths (const char* muhome, MuRuntimeData *data)
MU_XAPIAN_DIRNAME);
data->_str [MU_RUNTIME_PATH_BOOKMARKS] =
g_strdup_printf ("%s%c%s", muhome,G_DIR_SEPARATOR,
g_strdup_printf ("%s%c%s", muhome, G_DIR_SEPARATOR,
MU_BOOKMARKS_FILENAME);
data->_str [MU_RUNTIME_PATH_CACHE] =

View File

@ -98,7 +98,7 @@ mu_util_dir_expand (const char *path)
/* don't try realpath if the dir does not exist */
if (access (dir, F_OK) != 0)
return dir;
/* now resolve any symlinks, .. etc. */
if (realpath (dir, resolved) == NULL) {
g_debug ("%s: could not get realpath for '%s': %s",