#include <sys_defs.h>
#include <errno.h>
#include <msg.h>
#include <cleanup_user.h>
#include <rec_type.h>
#include "cleanup.h"
void cleanup_final(CLEANUP_STATE *state)
{
const char *myname = "cleanup_final";
if (vstream_fflush(state->dst)) {
if (errno == EFBIG) {
msg_warn("%s: queue file size limit exceeded", state->queue_id);
state->errs |= CLEANUP_STAT_SIZE;
} else {
msg_warn("%s: write queue file: %m", state->queue_id);
state->errs |= CLEANUP_STAT_WRITE;
}
return;
}
if (vstream_fseek(state->dst, 0L, SEEK_SET) < 0)
msg_fatal("%s: vstream_fseek %s: %m", myname, cleanup_path);
cleanup_out_format(state, REC_TYPE_SIZE, REC_TYPE_SIZE_FORMAT,
(REC_TYPE_SIZE_CAST1) (state->xtra_offset - state->data_offset),
(REC_TYPE_SIZE_CAST2) state->data_offset,
(REC_TYPE_SIZE_CAST3) state->rcpt_count,
(REC_TYPE_SIZE_CAST4) state->qmgr_opts,
(REC_TYPE_SIZE_CAST5) state->cont_length,
(REC_TYPE_SIZE_CAST6) state->smtputf8);
}