mail-transaction-log-append.c revision d8a786d2069fab818d0b62cd3eaa3ed08fe7c620
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen/* Copyright (c) 2003-2010 Dovecot authors, see the included COPYING file */
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenvoid mail_transaction_log_append_add(struct mail_transaction_log_append_ctx *ctx,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen i_assert((type & MAIL_TRANSACTION_TYPE_MASK) != 0);
55d33f807765482eb47374aaaced1fe714e0b256Timo Sirainen hdr.size = mail_index_uint32_to_offset(hdr.size);
55d33f807765482eb47374aaaced1fe714e0b256Timo Sirainen buffer_append(ctx->output, &hdr, sizeof(hdr));
41e51b972f02e8b16c19fab9160294ea0a07c343Timo Sirainen mail_transaction_update_modseq(&hdr, data, &ctx->new_highest_modseq);
55d33f807765482eb47374aaaced1fe714e0b256Timo Sirainenlog_buffer_move_to_memory(struct mail_transaction_log_append_ctx *ctx)
55d33f807765482eb47374aaaced1fe714e0b256Timo Sirainen struct mail_transaction_log_file *file = ctx->log->head;
c864fdd520b0c3f10a4b9bc5373368f4ae8faaffTimo Sirainen /* first we need to truncate this latest write so that log syncing
c864fdd520b0c3f10a4b9bc5373368f4ae8faaffTimo Sirainen doesn't break */
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen if (ftruncate(file->fd, file->sync_offset) < 0) {
struct mail_transaction_header_update *u;
int ret = 0;
return ret;