summaryrefslogtreecommitdiffstats
path: root/mbox.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2016-11-08 12:42:56 -0800
committerKevin McCarthy <kevin@8t8.us>2016-11-08 12:42:56 -0800
commite9de20435e17fa7bf5edb62fe5af19ae60158d9b (patch)
tree8041495ca2d6a7214b1174239c7e06d6b967cefb /mbox.c
parente494e70b9930e57198aaaa16ab6b008f73351149 (diff)
Move mbox close-append logic inside mbox_close_mailbox().
The mx_fastclose_mailbox() calls mx_ops->close(), which invokes mbox_close_mailbox(). Also, close the ctx->fp inside mbox_close_mailbox(). This way, the (to be added) compress logic can call the mx_ops->close() instead of "knowing" to close the fp before recompressing. mx_fastclose_mailbox() will safe_fclose() the fp again, but I'm leaving it there just in case I missed a usage of the fp in some other part of the code. Thanks to Damien Riegel for the original patch.
Diffstat (limited to 'mbox.c')
-rw-r--r--mbox.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/mbox.c b/mbox.c
index d3c2ec46..13fc3d62 100644
--- a/mbox.c
+++ b/mbox.c
@@ -465,6 +465,14 @@ static int mbox_open_mailbox_append (CONTEXT *ctx, int flags)
static int mbox_close_mailbox (CONTEXT *ctx)
{
+ if (ctx->append)
+ {
+ mx_unlock_file (ctx->path, fileno (ctx->fp), 1);
+ mutt_unblock_signals ();
+ }
+
+ safe_fclose (&ctx->fp);
+
return 0;
}