X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch.c;h=1ebd613eb3c95ede50914f2647fc9e5bb81f68d4;hp=966901f04b1c42b8affcfe23496b61eab3e4f6bc;hb=28fa0bc2d686761f50f5bd6782b81000c45ee0c4;hpb=7f254fb603f5ee073d48b052c00e1fdb6b8dc940 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. */