ostream-rawlog.c revision 3f7b9d04c1fb9b0a55ea2082214ea66a0ace96c7
f8740ac53310cd28ba4ec6dc9e9ce6e9a3688f39Timo Sirainen/* Copyright (c) 2011-2012 Dovecot authors, see the included COPYING file */
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainenstatic void o_stream_rawlog_close(struct iostream_private *stream)
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen struct rawlog_ostream *rstream = (struct rawlog_ostream *)stream;
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen (void)o_stream_flush(rstream->ostream.parent);
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Siraineno_stream_rawlog_sendv(struct ostream_private *stream,
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen const struct const_iovec *iov, unsigned int iov_count)
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen struct rawlog_ostream *rstream = (struct rawlog_ostream *)stream;
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen unsigned int i;
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen if ((ret = o_stream_sendv(stream->parent, iov, iov_count)) < 0) {
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen for (i = 0; i < iov_count && bytes > 0; i++) {
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Siraineno_stream_create_rawlog(struct ostream *output, const char *rawlog_path,
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen int rawlog_fd, enum iostream_rawlog_flags flags)
7000810786f2959f02cd6d2f4151a9eb61ff5db8Timo Sirainen rstream->ostream.sendv = o_stream_rawlog_sendv;
7000810786f2959f02cd6d2f4151a9eb61ff5db8Timo Sirainen rstream->ostream.iostream.close = o_stream_rawlog_close;
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen rstream->riostream.rawlog_path = i_strdup(rawlog_path);
d6a7cb184cc882a90aa3d9312082e0029f354ff6Timo Sirainen iostream_rawlog_init(&rstream->riostream, flags, FALSE);