summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compress.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/compress.c b/compress.c
index ae8d563b..0df85aed 100644
--- a/compress.c
+++ b/compress.c
@@ -541,22 +541,9 @@ open_append_mailbox (CONTEXT *ctx, int flags)
goto oa_fail1;
}
- ctx->magic = DefaultMagic;
- /* We can only deal with mbox and mmdf mailboxes */
- if ((ctx->magic != MUTT_MBOX) && (ctx->magic != MUTT_MMDF))
- goto oa_fail1;
-
if (setup_paths (ctx) != 0)
goto oa_fail2;
- ctx->mx_ops = &mx_comp_ops;
- ci->child_ops = mx_get_ops (ctx->magic);
- if (!ci->child_ops)
- {
- mutt_error (_("Can't find mailbox ops for mailbox type %d"), ctx->magic);
- goto oa_fail2;
- }
-
/* Lock the realpath for the duration of the append.
* It will be unlocked in the close */
if (!lock_realpath (ctx, 1))
@@ -574,6 +561,23 @@ open_append_mailbox (CONTEXT *ctx, int flags)
mutt_error (_("Compress command failed: %s"), ci->open);
goto oa_fail2;
}
+ ctx->magic = mx_get_magic (ctx->path);
+ }
+ else
+ ctx->magic = DefaultMagic;
+
+ /* We can only deal with mbox and mmdf mailboxes */
+ if ((ctx->magic != MUTT_MBOX) && (ctx->magic != MUTT_MMDF))
+ {
+ mutt_error (_("Unsupported mailbox type for appending."));
+ goto oa_fail2;
+ }
+
+ ci->child_ops = mx_get_ops (ctx->magic);
+ if (!ci->child_ops)
+ {
+ mutt_error (_("Can't find mailbox ops for mailbox type %d"), ctx->magic);
+ goto oa_fail2;
}
if (ci->child_ops->open_append (ctx, flags) != 0)