diff --git a/src/auth/auth-worker-client.c b/src/auth/auth-worker-client.c index 4d07018a3d..172b3816f0 100644 --- a/src/auth/auth-worker-client.c +++ b/src/auth/auth-worker-client.c @@ -117,7 +117,7 @@ static void auth_worker_send_reply(struct auth_worker_client *client, if (worker_restart_request) o_stream_nsend_str(client->output, "RESTART\n"); o_stream_nsend(client->output, str_data(str), str_len(str)); - if (o_stream_nfinish(client->output) < 0 && request != NULL && + if (o_stream_flush(client->output) < 0 && request != NULL && cmd_duration > AUTH_WORKER_WARN_DISCONNECTED_LONG_CMD_SECS) { p = i_strchr_to_next(str_c(str), '\t'); p = p == NULL ? "BUG" : t_strcut(p, '\t'); diff --git a/src/lib-auth/auth-master.c b/src/lib-auth/auth-master.c index b4f3a30e42..216e1c7f58 100644 --- a/src/lib-auth/auth-master.c +++ b/src/lib-auth/auth-master.c @@ -406,7 +406,7 @@ static int auth_master_run_cmd_pre(struct auth_master_connection *conn, o_stream_nsend_str(conn->output, cmd); o_stream_uncork(conn->output); - if (o_stream_nfinish(conn->output) < 0) { + if (o_stream_flush(conn->output) < 0) { i_error("write(auth socket) failed: %s", o_stream_get_error(conn->output)); auth_master_unset_io(conn); diff --git a/src/lib-fs/fs-api.h b/src/lib-fs/fs-api.h index eaadcc8a8a..6811961802 100644 --- a/src/lib-fs/fs-api.h +++ b/src/lib-fs/fs-api.h @@ -274,7 +274,7 @@ int fs_write(struct fs_file *file, const void *data, size_t size); fs_write_stream_finish/abort. The returned ostream is already corked and it doesn't need to be uncorked. */ struct ostream *fs_write_stream(struct fs_file *file); -/* Finish writing via stream, calling also o_stream_nfinish() on the stream and +/* Finish writing via stream, calling also o_stream_flush() on the stream and handling any pending errors. The file will be created/replaced/appended only after this call, same as with fs_write(). Anything written to the stream won't be visible earlier. Returns 1 if ok, 0 if async write isn't finished diff --git a/src/lib-storage/index/dbox-common/dbox-file-fix.c b/src/lib-storage/index/dbox-common/dbox-file-fix.c index f2684fcad5..6ed7904d28 100644 --- a/src/lib-storage/index/dbox-common/dbox-file-fix.c +++ b/src/lib-storage/index/dbox-common/dbox-file-fix.c @@ -243,7 +243,7 @@ stream_copy(struct dbox_file *file, struct ostream *output, "read(%s) failed: %s", file->cur_path, i_stream_get_error(input)); ret = -1; - } else if (o_stream_nfinish(output) < 0) { + } else if (o_stream_flush(output) < 0) { mail_storage_set_critical(&file->storage->storage, "write(%s) failed: %s", out_path, o_stream_get_error(output)); @@ -436,7 +436,7 @@ dbox_file_fix_write_stream(struct dbox_file *file, uoff_t start_offset, if (output->stream_errno != 0) break; } - if (o_stream_nfinish(output) < 0) { + if (o_stream_flush(output) < 0) { mail_storage_set_critical(&file->storage->storage, "write(%s) failed: %s", temp_path, o_stream_get_error(output)); ret = -1; diff --git a/src/lib-storage/index/dbox-common/dbox-file.c b/src/lib-storage/index/dbox-common/dbox-file.c index fa14f48432..0b3aed167e 100644 --- a/src/lib-storage/index/dbox-common/dbox-file.c +++ b/src/lib-storage/index/dbox-common/dbox-file.c @@ -551,7 +551,7 @@ int dbox_file_append_flush(struct dbox_file_append_context *ctx) ctx->last_checkpoint_offset == ctx->output->offset) return 0; - if (o_stream_nfinish(ctx->output) < 0) { + if (o_stream_flush(ctx->output) < 0) { dbox_file_set_syscall_error(ctx->file, "write()"); return -1; } diff --git a/src/lib-storage/index/dbox-common/dbox-save.c b/src/lib-storage/index/dbox-common/dbox-save.c index 619a7aba74..91424c8e2b 100644 --- a/src/lib-storage/index/dbox-common/dbox-save.c +++ b/src/lib-storage/index/dbox-common/dbox-save.c @@ -104,7 +104,7 @@ void dbox_save_end(struct dbox_save_context *ctx) ret = o_stream_finish(mdata->output); } else { /* no plugins - flush the output so far */ - ret = o_stream_nfinish(mdata->output); + ret = o_stream_flush(mdata->output); } if (ret < 0) { mail_storage_set_critical(ctx->ctx.transaction->box->storage, diff --git a/src/lib-storage/index/dbox-multi/mdbox-purge.c b/src/lib-storage/index/dbox-multi/mdbox-purge.c index 1dd4244b76..704d855f5a 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-purge.c +++ b/src/lib-storage/index/dbox-multi/mdbox-purge.c @@ -207,7 +207,7 @@ mdbox_purge_save_msg(struct mdbox_purge_context *ctx, struct dbox_file *file, input = i_stream_create_limit(file->input, msg_size); o_stream_nsend_istream(output, input); - if (o_stream_nfinish(output) < 0) { + if (o_stream_flush(output) < 0) { mail_storage_set_critical(&file->storage->storage, "write(%s) failed: %s", out_file_append->file->cur_path, diff --git a/src/lib-storage/index/mbox/mbox-save.c b/src/lib-storage/index/mbox/mbox-save.c index ef1759dbbb..3a13150c48 100644 --- a/src/lib-storage/index/mbox/mbox-save.c +++ b/src/lib-storage/index/mbox/mbox-save.c @@ -659,7 +659,7 @@ int mbox_save_finish(struct mail_save_context *_ctx) if (ctx->output != NULL) { /* make sure everything is written */ - if (o_stream_nfinish(ctx->output) < 0) + if (o_stream_flush(ctx->output) < 0) write_error(ctx); } @@ -681,7 +681,7 @@ int mbox_save_finish(struct mail_save_context *_ctx) if (ctx->failed && ctx->mail_offset != (uoff_t)-1) { /* saving this mail failed - truncate back to beginning of it */ - (void)o_stream_nfinish(ctx->output); + (void)o_stream_flush(ctx->output); if (ftruncate(ctx->mbox->mbox_fd, (off_t)ctx->mail_offset) < 0) mbox_set_syscall_error(ctx->mbox, "ftruncate()"); (void)o_stream_seek(ctx->output, ctx->mail_offset); @@ -775,7 +775,7 @@ int mbox_transaction_save_commit_pre(struct mail_save_context *_ctx) if (ctx->output != NULL) { /* flush the final LF */ - if (o_stream_nfinish(ctx->output) < 0) + if (o_stream_flush(ctx->output) < 0) write_error(ctx); } if (mbox->mbox_fd != -1 && !mbox->mbox_writeonly && diff --git a/src/lib/iostream-rawlog.c b/src/lib/iostream-rawlog.c index e4e800c11a..ea41a35e20 100644 --- a/src/lib/iostream-rawlog.c +++ b/src/lib/iostream-rawlog.c @@ -125,7 +125,7 @@ void iostream_rawlog_write(struct rawlog_iostream *rstream, iostream_rawlog_write_unbuffered(rstream, data, size); o_stream_uncork(rstream->rawlog_output); - if (o_stream_nfinish(rstream->rawlog_output) < 0) { + if (o_stream_flush(rstream->rawlog_output) < 0) { i_error("write(%s) failed: %s", o_stream_get_name(rstream->rawlog_output), o_stream_get_error(rstream->rawlog_output)); diff --git a/src/lmtp/commands.c b/src/lmtp/commands.c index 4ade60083e..45915293a7 100644 --- a/src/lmtp/commands.c +++ b/src/lmtp/commands.c @@ -1256,7 +1256,7 @@ static int client_input_add_file(struct client *client, o_stream_nsend(state->mail_data_output, state->mail_data->data, state->mail_data->used); o_stream_nsend(client->state.mail_data_output, data, size); - if (o_stream_nfinish(client->state.mail_data_output) < 0) { + if (o_stream_flush(client->state.mail_data_output) < 0) { i_error("write(%s) failed: %s", str_c(path), o_stream_get_error(client->state.mail_data_output)); return -1;