aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch.c
diff options
context:
space:
mode:
authorGravatar Carl Worth <cworth@cworth.org>2009-10-20 13:16:16 -0700
committerGravatar Carl Worth <cworth@cworth.org>2009-10-20 13:17:56 -0700
commit28fa0bc2d686761f50f5bd6782b81000c45ee0c4 (patch)
treeeb878ae6a94261a97300fddc770df5adc7a1deaa /notmuch.c
parent7f254fb603f5ee073d48b052c00e1fdb6b8dc940 (diff)
notmuch: Fix setup so that accepting the default mail path works.
The recent change from GIOChannel to getline, (with a semantic change of the newline terminator now being included in the result that setup_command sees), broke this.
Diffstat (limited to 'notmuch.c')
-rw-r--r--notmuch.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/notmuch.c b/notmuch.c
index 966901f0..1ebd613e 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -289,13 +289,17 @@ setup_command (int argc, char *argv[])
getline (&mail_directory, &line_size, stdin);
printf ("\n");
+ if (mail_directory &&
+ mail_directory[strlen(mail_directory)-1] == '\n')
+ {
+ mail_directory[strlen(mail_directory)-1] = '\0';
+ }
+
if (mail_directory == NULL || strlen (mail_directory) == 0) {
if (mail_directory)
free (mail_directory);
mail_directory = default_path;
} else {
- if (mail_directory[strlen(mail_directory)-1] == '\n')
- mail_directory[strlen(mail_directory)-1] = '\0';
/* XXX: Instead of telling the user to use an environment
* variable here, we should really be writing out a configuration
* file and loading that on the next run. */