From: Roger Cornelius Date: Wed, 26 Apr 2017 22:40:34 +0000 (-0700) Subject: Fix error message when opening a mailbox with no read permission. (closes #3934) X-Git-Tag: neomutt-20170602^2^2~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a1fe3723eaa87612c7576a8e99ac04ecff2282d3;p=neomutt Fix error message when opening a mailbox with no read permission. (closes #3934) ctx->mx_ops ends up being NULL for both the case that ctx->magic is 0 and -1. This meant the mutt_perror() error message was never being printed, because the check for ctx->mx_ops == NULL was taking place first. Move the "ctx->magic == -1" check first, so mutt will print out an appropriate perror message in that case. --- diff --git a/mx.c b/mx.c index 5e61798cf..21f38faeb 100644 --- a/mx.c +++ b/mx.c @@ -601,10 +601,10 @@ CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT *pctx) if (ctx->magic <= 0 || !ctx->mx_ops) { - if (ctx->magic == 0 || !ctx->mx_ops) - mutt_error (_("%s is not a mailbox."), path); - else if (ctx->magic == -1) + if (ctx->magic == -1) mutt_perror(path); + else if (ctx->magic == 0 || !ctx->mx_ops) + mutt_error (_("%s is not a mailbox."), path); mx_fastclose_mailbox (ctx); if (!pctx)