Skip to content

Commit

Permalink
#129: build: fix build, added prototype for o_stream_nfinished to avo…
Browse files Browse the repository at this point in the history
…id compilation errors with dovecot >= 2.3
  • Loading branch information
jrse committed Mar 8, 2018
1 parent d69f9bb commit 3b38a07
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/storage-rbox/rbox-save.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ using librmb::rbox_metadata_key;
using std::string;
using std::vector;

#if DOVECOT_PREREQ(2, 3)
// avoid compilation errors.
int o_stream_nfinish(struct ostream *stream) {}
#endif

struct mail_save_context *rbox_save_alloc(struct mailbox_transaction_context *t) {
FUNC_START();
struct rbox_mailbox *rbox = (struct rbox_mailbox *)t->box;
Expand Down Expand Up @@ -395,12 +400,12 @@ int rbox_save_finish(struct mail_save_context *_ctx) {

struct mail_save_data *mdata = &r_ctx->ctx.data;
if (mdata->output != r_ctx->output_stream) {
#if defined DOVECOT_VERSION_MAJOR == 2 && DOVECOT_VERSION_MINOR > 2
#if DOVECOT_PREREQ(2, 3)
/* e.g. zlib plugin had changed this. make sure we
successfully write the trailer. */
o_stream_finish(mdata->output);
#endif
#if defined DOVECOT_VERSION_MAJOR == 2 && DOVECOT_VERSION_MINOR < 3
#if DOVECOT_PREREQ(2, 2)
if (o_stream_nfinish(mdata->output) < 0) {
mail_storage_set_critical(r_ctx->ctx.transaction->box->storage, "write(%s) failed: %m",
o_stream_get_name(mdata->output));
Expand Down

0 comments on commit 3b38a07

Please sign in to comment.