From: Timo Sirainen Date: Mon, 16 May 2016 16:16:55 +0000 (+0300) Subject: lmtp: Fixed error logging when writing to temp file X-Git-Tag: 2.3.0.rc1~3722 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=61d89b0ca0300e230c7882b71e8360edf62d9cd0;p=thirdparty%2Fdovecot%2Fcore.git lmtp: Fixed error logging when writing to temp file --- diff --git a/src/lmtp/commands.c b/src/lmtp/commands.c index 1da462e12f..77d271cb7b 100644 --- a/src/lmtp/commands.c +++ b/src/lmtp/commands.c @@ -1178,7 +1178,6 @@ static int client_input_add_file(struct client *client, { struct client_state *state = &client->state; string_t *path; - ssize_t ret; int fd; if (state->mail_data_output != NULL) { @@ -1207,15 +1206,17 @@ static int client_input_add_file(struct client *client, state->mail_data_fd = fd; state->mail_data_output = o_stream_create_fd_file(fd, 0, FALSE); + o_stream_set_name(state->mail_data_output, str_c(path)); o_stream_cork(state->mail_data_output); - ret = o_stream_send(state->mail_data_output, - state->mail_data->data, state->mail_data->used); - if (ret != (ssize_t)state->mail_data->used) - return -1; - if (o_stream_send(client->state.mail_data_output, - data, size) != (ssize_t)size) + 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) { + i_error("write(%s) failed: %s", str_c(path), + o_stream_get_error(client->state.mail_data_output)); return -1; + } return 0; }