From: Pietro Cerutti Date: Thu, 1 Jun 2017 14:04:16 +0000 (+0100) Subject: Do not try to create Maildir if it is an NNTP URI (#600) X-Git-Tag: neomutt-20170602~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dfc89660326fbd175e090f505ab5267df6134048;p=neomutt Do not try to create Maildir if it is an NNTP URI (#600) Fixes #599 --- diff --git a/main.c b/main.c index d0aab289a..8325fa12b 100644 --- a/main.c +++ b/main.c @@ -504,19 +504,23 @@ int main(int argc, char **argv, char **environ) strfcpy(fpath, Maildir, sizeof(fpath)); mutt_expand_path(fpath, sizeof(fpath)); + bool skip = false; #ifdef USE_IMAP /* we're not connected yet - skip mail folder creation */ - if (!mx_is_imap(fpath)) + skip |= mx_is_imap(fpath); #endif - if (stat(fpath, &sb) == -1 && errno == ENOENT) +#ifdef USE_NNTP + skip |= mx_is_nntp(fpath); +#endif + if (!skip && stat(fpath, &sb) == -1 && errno == ENOENT) + { + snprintf(msg2, sizeof(msg2), _("%s does not exist. Create it?"), Maildir); + if (mutt_yesorno(msg2, MUTT_YES) == MUTT_YES) { - snprintf(msg2, sizeof(msg2), _("%s does not exist. Create it?"), Maildir); - if (mutt_yesorno(msg2, MUTT_YES) == MUTT_YES) - { - if (mkdir(fpath, 0700) == -1 && errno != EEXIST) - mutt_error(_("Can't create %s: %s."), Maildir, strerror(errno)); - } + if (mkdir(fpath, 0700) == -1 && errno != EEXIST) + mutt_error(_("Can't create %s: %s."), Maildir, strerror(errno)); } + } } if (batch_mode)