appends[count-1].size = cur_offset - appends[count-1].offset;
}
+void mdbox_map_append_abort(struct mdbox_map_append_context *ctx)
+{
+ struct mdbox_map_append *appends;
+ unsigned int count;
+
+ appends = array_get_modifiable(&ctx->appends, &count);
+ i_assert(count > 0 && appends[count-1].size == (uint32_t)-1);
+ array_delete(&ctx->appends, count-1, 1);
+}
+
static int mdbox_map_assign_file_ids(struct mdbox_map_append_context *ctx,
bool separate_transaction)
{
struct ostream **output_r);
/* Finished saving the last mail. Saves the message size. */
void mdbox_map_append_finish(struct mdbox_map_append_context *ctx);
+/* Abort saving the last mail. */
+void mdbox_map_append_abort(struct mdbox_map_append_context *ctx);
/* Assign map UIDs to all appended msgs to multi-files. */
int mdbox_map_append_assign_map_uids(struct mdbox_map_append_context *ctx,
uint32_t *first_map_uid_r,
i_stream_unref(&ctx->ctx.input);
if (ctx->ctx.failed) {
+ mdbox_map_append_abort(ctx->append_ctx);
array_delete(&ctx->mails, array_count(&ctx->mails) - 1, 1);
return -1;
}