From a1fe3723eaa87612c7576a8e99ac04ecff2282d3 Mon Sep 17 00:00:00 2001 From: Roger Cornelius Date: Wed, 26 Apr 2017 15:40:34 -0700 Subject: [PATCH] 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. --- mx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) -- 2.40.0