Skip to content

Commit

Permalink
global: Replace o_stream_nfinish() with o_stream_flush()
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen authored and Timo Sirainen committed Oct 30, 2017
1 parent ad9afb6 commit d1ba8ec
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/auth/auth-worker-client.c
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion src/lib-auth/auth-master.c
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/lib-fs/fs-api.h
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/lib-storage/index/dbox-common/dbox-file-fix.c
Expand Up @@ -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));
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/lib-storage/index/dbox-common/dbox-file.c
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib-storage/index/dbox-common/dbox-save.c
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/lib-storage/index/dbox-multi/mdbox-purge.c
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/lib-storage/index/mbox/mbox-save.c
Expand Up @@ -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);
}

Expand All @@ -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);
Expand Down Expand Up @@ -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 &&
Expand Down
2 changes: 1 addition & 1 deletion src/lib/iostream-rawlog.c
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion src/lmtp/commands.c
Expand Up @@ -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;
Expand Down

0 comments on commit d1ba8ec

Please sign in to comment.