9 /* #include "cleanup.h"
11 /* void cleanup_final(state)
12 /* CLEANUP_STATE *state;
14 /* cleanup_final() performs final queue file content (not
15 /* attribute) updates so that the file is ready to be closed.
19 /* The Secure Mailer license must be distributed with this software.
22 /* IBM T.J. Watson Research
24 /* Yorktown Heights, NY 10598, USA
32 /* Utility library. */
38 #include <cleanup_user.h>
41 /* Application-specific. */
45 /* cleanup_final - final queue file content updates */
47 void cleanup_final(CLEANUP_STATE
*state
)
49 const char *myname
= "cleanup_final";
52 * vstream_fseek() would flush the buffer anyway, but the code just reads
53 * better if we flush first, because it makes seek error handling more
56 if (vstream_fflush(state
->dst
)) {
58 msg_warn("%s: queue file size limit exceeded", state
->queue_id
);
59 state
->errs
|= CLEANUP_STAT_SIZE
;
61 msg_warn("%s: write queue file: %m", state
->queue_id
);
62 state
->errs
|= CLEANUP_STAT_WRITE
;
68 * Update the preliminary message size and count fields with the actual
71 if (vstream_fseek(state
->dst
, 0L, SEEK_SET
) < 0)
72 msg_fatal("%s: vstream_fseek %s: %m", myname
, cleanup_path
);
73 cleanup_out_format(state
, REC_TYPE_SIZE
, REC_TYPE_SIZE_FORMAT
,
74 (REC_TYPE_SIZE_CAST1
) (state
->xtra_offset
- state
->data_offset
),
75 (REC_TYPE_SIZE_CAST2
) state
->data_offset
,
76 (REC_TYPE_SIZE_CAST3
) state
->rcpt_count
,
77 (REC_TYPE_SIZE_CAST4
) state
->qmgr_opts
,
78 (REC_TYPE_SIZE_CAST5
) state
->cont_length
);