summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2011-04-24 16:03:40 +0300
committerDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2011-04-24 16:03:40 +0300
commit8f9bd404cfdfc0ebfcc7c7021b736ad47537319c (patch)
tree2c54d9c6db7dfe6c428c1e6be7b242393cc552f0
parent3b3dc10b67e44dae4f3346cc00578b337d8d9fae (diff)
* fix infinite loop in mu-cmd-index (fixes issue #36) + some cosmetics
-rw-r--r--src/mu-cmd-index.c18
-rw-r--r--src/mu-runtime.c2
-rw-r--r--src/mu-util.c2
3 files changed, 12 insertions, 10 deletions
diff --git a/src/mu-cmd-index.c b/src/mu-cmd-index.c
index 6c351bb..90a84e2 100644
--- a/src/mu-cmd-index.c
+++ b/src/mu-cmd-index.c
@@ -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);
}
diff --git a/src/mu-runtime.c b/src/mu-runtime.c
index 89ab724..14c0c3d 100644
--- a/src/mu-runtime.c
+++ b/src/mu-runtime.c
@@ -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] =
diff --git a/src/mu-util.c b/src/mu-util.c
index 90c2a9a..e6146e8 100644
--- a/src/mu-util.c
+++ b/src/mu-util.c
@@ -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",