diff --git a/src/auth/mech-winbind.c b/src/auth/mech-winbind.c index c9e1450f0b..4a65696105 100644 --- a/src/auth/mech-winbind.c +++ b/src/auth/mech-winbind.c @@ -180,7 +180,8 @@ do_auth_continue(struct auth_request *auth_request, str_data(str), str_len(str)) < 0 || o_stream_flush(request->winbind->out_pipe) < 0) { auth_request_log_error(auth_request, AUTH_SUBSYS_MECH, - "write(out_pipe) failed: %m"); + "write(out_pipe) failed: %s", + o_stream_get_error(request->winbind->out_pipe)); return HR_RESTART; } request->continued = FALSE; diff --git a/src/auth/userdb-passwd-file.c b/src/auth/userdb-passwd-file.c index b578d272b6..f80cac1f9e 100644 --- a/src/auth/userdb-passwd-file.c +++ b/src/auth/userdb-passwd-file.c @@ -139,7 +139,8 @@ static void passwd_file_iterate_next(struct userdb_iterate_context *_ctx) break; } if (line == NULL && ctx->input->stream_errno != 0) { - i_error("read(%s) failed: %m", ctx->path); + i_error("read(%s) failed: %s", ctx->path, + i_stream_get_error(ctx->input)); _ctx->failed = TRUE; } } diff --git a/src/director/director-connection.c b/src/director/director-connection.c index a727658efd..2beb327073 100644 --- a/src/director/director-connection.c +++ b/src/director/director-connection.c @@ -2051,9 +2051,10 @@ void director_connection_send(struct director_connection *conn, } T_END; ret = o_stream_send(conn->output, data, len); if (ret != (off_t)len) { - if (ret < 0) - i_error("director(%s): write() failed: %m", conn->name); - else { + if (ret < 0) { + i_error("director(%s): write() failed: %s", conn->name, + o_stream_get_error(conn->output)); + } else { i_error("director(%s): Output buffer full, " "disconnecting", conn->name); } diff --git a/src/doveadm/doveadm-director.c b/src/doveadm/doveadm-director.c index 76accd2566..383a62c4a3 100644 --- a/src/doveadm/doveadm-director.c +++ b/src/doveadm/doveadm-director.c @@ -60,11 +60,12 @@ static void director_connect(struct director_context *ctx) line = i_stream_read_next_line(ctx->input); alarm(0); if (line == NULL) { - if (ctx->input->stream_errno != 0) - i_fatal("read(%s) failed: %m", ctx->socket_path); - else if (ctx->input->eof) + if (ctx->input->stream_errno != 0) { + i_fatal("read(%s) failed: %s", ctx->socket_path, + i_stream_get_error(ctx->input)); + } else if (ctx->input->eof) { i_fatal("%s disconnected", ctx->socket_path); - else { + } else { i_fatal("read(%s) timed out (is director configured?)", ctx->socket_path); } @@ -79,8 +80,10 @@ static void director_connect(struct director_context *ctx) static void director_disconnect(struct director_context *ctx) { if (ctx->input != NULL) { - if (ctx->input->stream_errno != 0) - i_fatal("read(%s) failed: %m", ctx->socket_path); + if (ctx->input->stream_errno != 0) { + i_fatal("read(%s) failed: %s", ctx->socket_path, + i_stream_get_error(ctx->input)); + } i_stream_destroy(&ctx->input); } } diff --git a/src/doveadm/doveadm-penalty.c b/src/doveadm/doveadm-penalty.c index 36b9fd85f4..2a4b33d887 100644 --- a/src/doveadm/doveadm-penalty.c +++ b/src/doveadm/doveadm-penalty.c @@ -80,8 +80,10 @@ static void penalty_lookup(struct penalty_context *ctx) penalty_print_line(ctx, &penalty_line); } T_END; } - if (input->stream_errno != 0) - i_fatal("read(%s) failed: %m", ctx->anvil_path); + if (input->stream_errno != 0) { + i_fatal("read(%s) failed: %s", ctx->anvil_path, + i_stream_get_error(input)); + } i_stream_destroy(&input); } diff --git a/src/doveadm/doveadm-replicator.c b/src/doveadm/doveadm-replicator.c index 6459a6c0f9..390572b530 100644 --- a/src/doveadm/doveadm-replicator.c +++ b/src/doveadm/doveadm-replicator.c @@ -48,9 +48,10 @@ static void replicator_connect(struct replicator_context *ctx) line = i_stream_read_next_line(ctx->input); alarm(0); if (line == NULL) { - if (ctx->input->stream_errno != 0) - i_fatal("read(%s) failed: %m", ctx->socket_path); - else if (ctx->input->eof) + if (ctx->input->stream_errno != 0) { + i_fatal("read(%s) failed: %s", ctx->socket_path, + i_stream_get_error(ctx->input)); + } else if (ctx->input->eof) i_fatal("%s disconnected", ctx->socket_path); else i_fatal("read(%s) timed out", ctx->socket_path); @@ -64,8 +65,10 @@ static void replicator_connect(struct replicator_context *ctx) static void replicator_disconnect(struct replicator_context *ctx) { - if (ctx->input->stream_errno != 0) - i_fatal("read(%s) failed: %m", ctx->socket_path); + if (ctx->input->stream_errno != 0) { + i_fatal("read(%s) failed: %s", ctx->socket_path, + i_stream_get_error(ctx->input)); + } i_stream_destroy(&ctx->input); } diff --git a/src/doveadm/doveadm-stats.c b/src/doveadm/doveadm-stats.c index 81e6f25623..54201ed78a 100644 --- a/src/doveadm/doveadm-stats.c +++ b/src/doveadm/doveadm-stats.c @@ -111,7 +111,7 @@ static void stats_dump(const char *path, const char *cmd) } while (args != NULL); } if (input->stream_errno != 0) - i_fatal("read(%s) failed: %m", path); + i_fatal("read(%s) failed: %s", path, i_stream_get_error(input)); i_stream_destroy(&input); } @@ -194,8 +194,10 @@ static void stats_read(struct top_context *ctx) hash_table_insert(ctx->sessions, line->id, line); } - if (ctx->input->stream_errno != 0) - i_fatal("read(%s) failed: %m", ctx->path); + if (ctx->input->stream_errno != 0) { + i_fatal("read(%s) failed: %s", ctx->path, + i_stream_get_error(ctx->input)); + } i_fatal("read(%s): unexpected EOF", ctx->path); } diff --git a/src/doveadm/doveadm-who.c b/src/doveadm/doveadm-who.c index 3b75b9a9a6..d0f3b0f5d7 100644 --- a/src/doveadm/doveadm-who.c +++ b/src/doveadm/doveadm-who.c @@ -169,8 +169,10 @@ void who_lookup(struct who_context *ctx, who_callback_t *callback) callback(ctx, &who_line); } T_END; } - if (input->stream_errno != 0) - i_fatal("read(%s) failed: %m", ctx->anvil_path); + if (input->stream_errno != 0) { + i_fatal("read(%s) failed: %s", ctx->anvil_path, + i_stream_get_error(input)); + } i_stream_destroy(&input); } diff --git a/src/doveadm/doveadm-zlib.c b/src/doveadm/doveadm-zlib.c index 957d4dd42d..10c964afb9 100644 --- a/src/doveadm/doveadm-zlib.c +++ b/src/doveadm/doveadm-zlib.c @@ -122,8 +122,8 @@ static void server_input(struct client *client) if (i_stream_read(client->input) == -1) { if (client->input->stream_errno != 0) { - errno = client->input->stream_errno; - i_fatal("read(server) failed: %m"); + i_fatal("read(server) failed: %s", + i_stream_get_error(client->input)); } i_info("Server disconnected"); diff --git a/src/lib-auth/auth-master.c b/src/lib-auth/auth-master.c index a138417e20..b3ceab510f 100644 --- a/src/lib-auth/auth-master.c +++ b/src/lib-auth/auth-master.c @@ -413,7 +413,8 @@ static int auth_master_run_cmd_pre(struct auth_master_connection *conn, o_stream_uncork(conn->output); if (o_stream_nfinish(conn->output) < 0) { - i_error("write(auth socket) failed: %m"); + i_error("write(auth socket) failed: %s", + o_stream_get_error(conn->output)); auth_master_unset_io(conn); auth_connection_close(conn); return -1; diff --git a/src/lib-auth/auth-server-connection.c b/src/lib-auth/auth-server-connection.c index 528d49a671..8453a3a61f 100644 --- a/src/lib-auth/auth-server-connection.c +++ b/src/lib-auth/auth-server-connection.c @@ -453,9 +453,10 @@ int auth_server_connection_connect(struct auth_server_connection *conn) AUTH_CLIENT_PROTOCOL_MINOR_VERSION, conn->client->client_pid); if (o_stream_send_str(conn->output, handshake) < 0) { - i_warning("Error sending handshake to auth server: %m"); + i_warning("Error sending handshake to auth server: %s", + o_stream_get_error(conn->output)); auth_server_connection_disconnect(conn, - strerror(conn->output->last_failed_errno)); + o_stream_get_error(conn->output)); return -1; } diff --git a/src/lib-http/http-server-response.c b/src/lib-http/http-server-response.c index f837936474..0c721d2f12 100644 --- a/src/lib-http/http-server-response.c +++ b/src/lib-http/http-server-response.c @@ -142,8 +142,8 @@ void http_server_response_set_payload(struct http_server_response *resp, resp->payload_input = input; if ((ret = i_stream_get_size(input, TRUE, &resp->payload_size)) <= 0) { if (ret < 0) { - i_error("i_stream_get_size(%s) failed: %m", - i_stream_get_name(input)); + i_error("i_stream_get_size(%s) failed: %s", + i_stream_get_name(input), i_stream_get_error(input)); } resp->payload_size = 0; resp->payload_chunked = TRUE; @@ -500,16 +500,16 @@ int http_server_response_send_more(struct http_server_response *resp, if (resp->payload_input->stream_errno != 0) { /* we're in the middle of sending a response, so the connection will also have to be aborted */ - errno = resp->payload_input->stream_errno; - *error_r = t_strdup_printf("read(%s) failed: %m", - i_stream_get_name(resp->payload_input)); + *error_r = t_strdup_printf("read(%s) failed: %s", + i_stream_get_name(resp->payload_input), + i_stream_get_error(resp->payload_input)); ret = -1; } else if (output->stream_errno != 0) { /* failed to send response */ - errno = output->stream_errno; - if (errno != EPIPE && errno != ECONNRESET) { - *error_r = t_strdup_printf("write(%s) failed: %m", - o_stream_get_name(output)); + if (output->stream_errno != EPIPE && + output->stream_errno != ECONNRESET) { + *error_r = t_strdup_printf("write(%s) failed: %s", + o_stream_get_name(output), o_stream_get_error(output)); } ret = -1; } else { @@ -646,9 +646,10 @@ static int http_server_response_send_real(struct http_server_response *resp, o_stream_ref(output); o_stream_cork(output); if (o_stream_sendv(output, iov, N_ELEMENTS(iov)) < 0) { - if (errno != EPIPE && errno != ECONNRESET) { - *error_r = t_strdup_printf("write(%s) failed: %m", - o_stream_get_name(output)); + if (output->stream_errno != EPIPE && + output->stream_errno != ECONNRESET) { + *error_r = t_strdup_printf("write(%s) failed: %s", + o_stream_get_name(output), o_stream_get_error(output)); } ret = -1; } diff --git a/src/lib-index/mail-index-strmap.c b/src/lib-index/mail-index-strmap.c index 4f5de33d09..549eaf45f1 100644 --- a/src/lib-index/mail-index-strmap.c +++ b/src/lib-index/mail-index-strmap.c @@ -1017,8 +1017,8 @@ static int mail_index_strmap_recreate(struct mail_index_strmap_view *view) o_stream_cork(output); mail_index_strmap_recreate_write(view, output); if (o_stream_nfinish(output) < 0) { - mail_index_set_error(strmap->index, - "write(%s) failed: %m", temp_path); + mail_index_set_error(strmap->index, "write(%s) failed: %s", + temp_path, o_stream_get_error(output)); ret = -1; } o_stream_destroy(&output); diff --git a/src/lib-lda/duplicate.c b/src/lib-lda/duplicate.c index 0e458d06ae..9cf1757325 100644 --- a/src/lib-lda/duplicate.c +++ b/src/lib-lda/duplicate.c @@ -317,7 +317,8 @@ void duplicate_flush(struct duplicate_context *ctx) hash_table_iterate_deinit(&iter); if (o_stream_nfinish(output) < 0) { - i_error("write(%s) failed: %m", file->path); + i_error("write(%s) failed: %s", file->path, + o_stream_get_error(output)); o_stream_unref(&output); duplicate_file_free(&ctx->file); return; diff --git a/src/lib-lda/lmtp-client.c b/src/lib-lda/lmtp-client.c index 5c91e7d72c..4d16a4ea12 100644 --- a/src/lib-lda/lmtp-client.c +++ b/src/lib-lda/lmtp-client.c @@ -603,8 +603,8 @@ static void lmtp_client_input(struct lmtp_client *client) lmtp_client_fail(client, "501 5.5.4 Command reply line too long"); } else if (client->input->stream_errno != 0) { - errno = client->input->stream_errno; - i_error("lmtp client: read() failed: %m"); + i_error("lmtp client: read() failed: %s", + i_stream_get_error(client->input)); lmtp_client_fail(client, ERRSTR_TEMP_REMOTE_FAILURE " (read failure)"); } else if (client->input->eof) { diff --git a/src/lib-lda/smtp-client.c b/src/lib-lda/smtp-client.c index 28bb1eb3b2..131766ef03 100644 --- a/src/lib-lda/smtp-client.c +++ b/src/lib-lda/smtp-client.c @@ -265,14 +265,14 @@ smtp_client_send_flush(struct smtp_client *smtp_client, } if (o_stream_nfinish(smtp_client->output) < 0) { - *error_r = t_strdup_printf("write(%s) failed: %m", - smtp_client->temp_path); + *error_r = t_strdup_printf("write(%s) failed: %s", + smtp_client->temp_path, o_stream_get_error(smtp_client->output)); return -1; } if (o_stream_seek(smtp_client->output, 0) < 0) { - *error_r = t_strdup_printf("lseek(%s) failed: %m", - smtp_client->temp_path); + *error_r = t_strdup_printf("lseek(%s) failed: %s", + smtp_client->temp_path, o_stream_get_error(smtp_client->output)); return -1; } diff --git a/src/lib-master/anvil-client.c b/src/lib-master/anvil-client.c index 553b21b041..eff41ff578 100644 --- a/src/lib-master/anvil-client.c +++ b/src/lib-master/anvil-client.c @@ -113,7 +113,8 @@ static void anvil_input(struct anvil_client *client) aqueue_delete_tail(client->queries); } if (client->input->stream_errno != 0) { - i_error("read(%s) failed: %m", client->path); + i_error("read(%s) failed: %s", client->path, + i_stream_get_error(client->input)); anvil_reconnect(client); } else if (client->input->eof) { i_error("read(%s) failed: EOF", client->path); diff --git a/src/lib-master/master-instance.c b/src/lib-master/master-instance.c index b05ecb2900..271adfe278 100644 --- a/src/lib-master/master-instance.c +++ b/src/lib-master/master-instance.c @@ -116,7 +116,7 @@ static int master_instance_list_refresh(struct master_instance_list *list) i_error("Invalid line in %s: %s", list->path, line); } T_END; if (input->stream_errno != 0) { - i_error("read(%s) failed: %m", line); + i_error("read(%s) failed: %s", line, i_stream_get_error(input)); ret = -1; } i_stream_destroy(&input); @@ -147,7 +147,7 @@ master_instance_list_write(struct master_instance_list *list, o_stream_nsend(output, str_data(str), str_len(str)); } if (o_stream_nfinish(output) < 0) { - i_error("write(%s) failed: %m", path); + i_error("write(%s) failed: %s", path, o_stream_get_error(output)); ret = -1; } o_stream_destroy(&output); diff --git a/src/lib-master/master-service-settings.c b/src/lib-master/master-service-settings.c index 5d02c2b80b..4a25f6592c 100644 --- a/src/lib-master/master-service-settings.c +++ b/src/lib-master/master-service-settings.c @@ -327,7 +327,8 @@ config_read_reply_header(struct istream *istream, const char *path, pool_t pool, if (ret == 0) return 1; *error_r = istream->stream_errno != 0 ? - t_strdup_printf("read(%s) failed: %m", path) : + t_strdup_printf("read(%s) failed: %s", path, + i_stream_get_error(istream)) : t_strdup_printf("read(%s) failed: EOF", path); return -1; } diff --git a/src/lib-storage/index/cydir/cydir-save.c b/src/lib-storage/index/cydir/cydir-save.c index 0131521ef0..f2a7e9b4d9 100644 --- a/src/lib-storage/index/cydir/cydir-save.c +++ b/src/lib-storage/index/cydir/cydir-save.c @@ -151,7 +151,8 @@ static int cydir_save_flush(struct cydir_save_context *ctx, const char *path) int ret = 0; if (o_stream_nfinish(ctx->ctx.data.output) < 0) { - mail_storage_set_critical(storage, "write(%s) failed: %m", path); + mail_storage_set_critical(storage, "write(%s) failed: %s", path, + o_stream_get_error(ctx->ctx.data.output)); ret = -1; } diff --git a/src/lib-storage/index/dbox-multi/mdbox-purge.c b/src/lib-storage/index/dbox-multi/mdbox-purge.c index a8911412cc..fc566a8430 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-purge.c +++ b/src/lib-storage/index/dbox-multi/mdbox-purge.c @@ -78,7 +78,8 @@ mdbox_file_read_metadata_hdr(struct dbox_file *file, return 0; } mail_storage_set_critical(&file->storage->storage, - "read(%s) failed: %m", file->cur_path); + "read(%s) failed: %s", file->cur_path, + i_stream_get_error(file->input)); return -1; } @@ -191,7 +192,6 @@ mdbox_purge_save_msg(struct mdbox_purge_context *ctx, struct dbox_file *file, enum mdbox_map_append_flags append_flags; uoff_t msg_size; off_t ret; - int read_errno; if (ctx->append_ctx == NULL) ctx->append_ctx = mdbox_map_append_begin(ctx->atomic); @@ -207,19 +207,19 @@ mdbox_purge_save_msg(struct mdbox_purge_context *ctx, struct dbox_file *file, input = i_stream_create_limit(file->input, msg_size); ret = o_stream_send_istream(output, input); - read_errno = input->stream_errno; - i_stream_unref(&input); - - if (read_errno != 0) { - errno = read_errno; + if (input->stream_errno != 0) { mail_storage_set_critical(&file->storage->storage, - "read(%s) failed: %m", file->cur_path); + "read(%s) failed: %s", file->cur_path, + i_stream_get_error(input)); + i_stream_unref(&input); return -1; } + i_stream_unref(&input); if (o_stream_nfinish(output) < 0) { mail_storage_set_critical(&file->storage->storage, - "write(%s) failed: %m", - out_file_append->file->cur_path); + "write(%s) failed: %s", + out_file_append->file->cur_path, + o_stream_get_error(output)); return -1; } if (ret != (off_t)msg_size) { diff --git a/src/lib-storage/index/dbox-single/sdbox-file.c b/src/lib-storage/index/dbox-single/sdbox-file.c index 4cdaaf2aa7..47622b9fed 100644 --- a/src/lib-storage/index/dbox-single/sdbox-file.c +++ b/src/lib-storage/index/dbox-single/sdbox-file.c @@ -323,20 +323,15 @@ int sdbox_file_move(struct dbox_file *file, bool alt_path) output = o_stream_create_fd_file(out_fd, 0, FALSE); i_stream_seek(file->input, 0); - while ((ret = o_stream_send_istream(output, file->input)) > 0) ; + ret = o_stream_send_istream(output, file->input) > 0 ? 0 : -1; if (o_stream_nfinish(output) < 0) { - mail_storage_set_critical(storage, "write(%s) failed: %m", - temp_path); + mail_storage_set_critical(storage, "write(%s) failed: %s", + temp_path, o_stream_get_error(output)); ret = -1; } else if (file->input->stream_errno != 0) { - errno = file->input->stream_errno; - dbox_file_set_syscall_error(file, "ftruncate()"); + mail_storage_set_critical(storage, "read(%s) failed: %s", + temp_path, i_stream_get_error(file->input)); ret = -1; - } else if (ret < 0) { - mail_storage_set_critical(storage, - "o_stream_send_istream(%s, %s) " - "failed with unknown error", - temp_path, file->cur_path); } o_stream_unref(&output); diff --git a/src/lib-storage/index/imapc/imapc-save.c b/src/lib-storage/index/imapc/imapc-save.c index ff9e23b228..b8a6919b5f 100644 --- a/src/lib-storage/index/imapc/imapc-save.c +++ b/src/lib-storage/index/imapc/imapc-save.c @@ -274,7 +274,8 @@ int imapc_save_finish(struct mail_save_context *_ctx) if (o_stream_nfinish(_ctx->data.output) < 0) { if (!mail_storage_set_error_from_errno(storage)) { mail_storage_set_critical(storage, - "write(%s) failed: %m", ctx->temp_path); + "write(%s) failed: %s", ctx->temp_path, + o_stream_get_error(_ctx->data.output)); } ctx->failed = TRUE; } diff --git a/src/lib-storage/index/index-attachment.c b/src/lib-storage/index/index-attachment.c index 5ec3efd042..4b7abd9129 100644 --- a/src/lib-storage/index/index-attachment.c +++ b/src/lib-storage/index/index-attachment.c @@ -196,10 +196,9 @@ static int save_check_write_error(struct mail_storage *storage, if (output->last_failed_errno == 0) return 0; - errno = output->last_failed_errno; if (!mail_storage_set_error_from_errno(storage)) { - mail_storage_set_critical(storage, "write(%s) failed: %m", - o_stream_get_name(output)); + mail_storage_set_critical(storage, "write(%s) failed: %s", + o_stream_get_name(output), o_stream_get_error(output)); } return -1; } diff --git a/src/lib-storage/index/maildir/maildir-save.c b/src/lib-storage/index/maildir/maildir-save.c index 8999737a9d..f20fd76afb 100644 --- a/src/lib-storage/index/maildir/maildir-save.c +++ b/src/lib-storage/index/maildir/maildir-save.c @@ -524,7 +524,7 @@ static int maildir_save_finish_real(struct mail_save_context *_ctx) { struct maildir_save_context *ctx = (struct maildir_save_context *)_ctx; struct mail_storage *storage = &ctx->mbox->storage->storage; - const char *path; + const char *path, *output_errstr; off_t real_size; uoff_t size; int output_errno; @@ -539,7 +539,8 @@ static int maildir_save_finish_real(struct mail_save_context *_ctx) if (!ctx->failed && o_stream_nfinish(_ctx->data.output) < 0) { if (!mail_storage_set_error_from_errno(storage)) { mail_storage_set_critical(storage, - "write(%s) failed: %m", path); + "write(%s) failed: %s", path, + o_stream_get_error(_ctx->data.output)); } ctx->failed = TRUE; } @@ -570,6 +571,7 @@ static int maildir_save_finish_real(struct mail_save_context *_ctx) ctx->file_last->vsize = (uoff_t)-1; output_errno = _ctx->data.output->last_failed_errno; + output_errstr = t_strdup(o_stream_get_error(_ctx->data.output)); o_stream_destroy(&_ctx->data.output); if (storage->set->parsed_fsync_mode != FSYNC_MODE_NEVER && @@ -613,13 +615,12 @@ static int maildir_save_finish_real(struct mail_save_context *_ctx) /* delete the tmp file */ i_unlink_if_exists(path); - errno = output_errno; - if (ENOQUOTA(errno)) { + if (ENOQUOTA(output_errno)) { mail_storage_set_error(storage, MAIL_ERROR_NOQUOTA, MAIL_ERRSTR_NO_QUOTA); - } else if (errno != 0) { + } else if (output_errno != 0) { mail_storage_set_critical(storage, - "write(%s) failed: %m", path); + "write(%s) failed: %s", path, output_errstr); } maildir_save_remove_last_filename(ctx); diff --git a/src/lib-storage/index/maildir/maildir-uidlist.c b/src/lib-storage/index/maildir/maildir-uidlist.c index eb89aa558d..b0208f2672 100644 --- a/src/lib-storage/index/maildir/maildir-uidlist.c +++ b/src/lib-storage/index/maildir/maildir-uidlist.c @@ -832,9 +832,9 @@ maildir_uidlist_update_read(struct maildir_uidlist *uidlist, if (input->stream_errno == ESTALE && try_retry) *retry_r = TRUE; else { - errno = input->stream_errno; mail_storage_set_critical(storage, - "read(%s) failed: %m", uidlist->path); + "read(%s) failed: %s", uidlist->path, + i_stream_get_error(input)); } uidlist->last_read_offset = 0; } @@ -1312,7 +1312,8 @@ static int maildir_uidlist_write_fd(struct maildir_uidlist *uidlist, int fd, maildir_uidlist_iter_deinit(&iter); if (o_stream_nfinish(output) < 0) { - mail_storage_set_critical(storage, "write(%s) failed: %m", path); + mail_storage_set_critical(storage, "write(%s) failed: %s", path, + o_stream_get_error(output)); o_stream_unref(&output); return -1; } diff --git a/src/lib/json-parser.c b/src/lib/json-parser.c index fe54a19cdf..4e6afbf85c 100644 --- a/src/lib/json-parser.c +++ b/src/lib/json-parser.c @@ -133,8 +133,9 @@ int json_parser_deinit(struct json_parser **_parser, const char **error_r) /* actual parser error */ *error_r = parser->error; } else if (parser->input->stream_errno != 0) { - *error_r = t_strdup_printf("read(%s) failed: %m", - i_stream_get_name(parser->input)); + *error_r = t_strdup_printf("read(%s) failed: %s", + i_stream_get_name(parser->input), + i_stream_get_error(parser->input)); } else if (parser->data == parser->end && !i_stream_have_bytes_left(parser->input) && parser->state != JSON_STATE_DONE) { diff --git a/src/plugins/acl/acl-backend-vfile-acllist.c b/src/plugins/acl/acl-backend-vfile-acllist.c index 28764171b0..6e3fd226d9 100644 --- a/src/plugins/acl/acl-backend-vfile-acllist.c +++ b/src/plugins/acl/acl-backend-vfile-acllist.c @@ -279,7 +279,8 @@ acl_backend_vfile_acllist_try_rebuild(struct acl_backend_vfile *backend) } if (o_stream_nfinish(output) < 0) { - i_error("write(%s) failed: %m", str_c(path)); + i_error("write(%s) failed: %s", str_c(path), + o_stream_get_error(output)); ret = -1; } if (mailbox_list_iter_deinit(&iter) < 0) diff --git a/src/plugins/acl/acl-backend-vfile-update.c b/src/plugins/acl/acl-backend-vfile-update.c index ecd2dea99d..0c2ebadee0 100644 --- a/src/plugins/acl/acl-backend-vfile-update.c +++ b/src/plugins/acl/acl-backend-vfile-update.c @@ -159,7 +159,8 @@ acl_backend_vfile_update_write(struct acl_object *aclobj, } str_free(&str); if (o_stream_nfinish(output) < 0) { - i_error("write(%s) failed: %m", path); + i_error("write(%s) failed: %s", path, + o_stream_get_error(output)); ret = -1; } o_stream_destroy(&output); diff --git a/src/plugins/acl/acl-backend-vfile.c b/src/plugins/acl/acl-backend-vfile.c index 188a41cbaa..db8048a5df 100644 --- a/src/plugins/acl/acl-backend-vfile.c +++ b/src/plugins/acl/acl-backend-vfile.c @@ -393,7 +393,8 @@ acl_backend_vfile_read(struct acl_object *aclobj, bool global, const char *path, ret = 0; else { ret = -1; - i_error("read(%s) failed: %m", path); + i_error("read(%s) failed: %s", path, + i_stream_get_error(input)); } } else { if (fstat(fd, &st) < 0) { diff --git a/src/plugins/fts-squat/squat-trie.c b/src/plugins/fts-squat/squat-trie.c index 0861f21b0c..b3d8fa301b 100644 --- a/src/plugins/fts-squat/squat-trie.c +++ b/src/plugins/fts-squat/squat-trie.c @@ -1680,7 +1680,8 @@ static int squat_trie_write(struct squat_trie_build_context *ctx) o_stream_nsend(output, &trie->hdr, sizeof(trie->hdr)); } if (o_stream_nfinish(output) < 0) { - i_error("write() to %s failed: %m", path); + i_error("write(%s) failed: %s", path, + o_stream_get_error(output)); ret = -1; } o_stream_destroy(&output); diff --git a/src/plugins/fts-squat/squat-uidlist.c b/src/plugins/fts-squat/squat-uidlist.c index 92bc86fa46..1b7fb1cad1 100644 --- a/src/plugins/fts-squat/squat-uidlist.c +++ b/src/plugins/fts-squat/squat-uidlist.c @@ -861,7 +861,8 @@ int squat_uidlist_build_finish(struct squat_uidlist_build_context *ctx) } if (o_stream_nfinish(ctx->output) < 0) { - i_error("write() to %s failed: %m", ctx->uidlist->path); + i_error("write() to %s failed: %s", ctx->uidlist->path, + o_stream_get_error(ctx->output)); return -1; } return 0; @@ -1064,7 +1065,8 @@ int squat_uidlist_rebuild_finish(struct squat_uidlist_rebuild_context *ctx, if (ctx->uidlist->corrupted) ret = -1; else if (o_stream_nfinish(ctx->output) < 0) { - i_error("write() to %s failed: %m", temp_path); + i_error("write(%s) failed: %s", temp_path, + o_stream_get_error(ctx->output)); ret = -1; } else if (rename(temp_path, ctx->uidlist->path) < 0) { i_error("rename(%s, %s) failed: %m", diff --git a/src/plugins/fts/fts-expunge-log.c b/src/plugins/fts/fts-expunge-log.c index cf94ba12bb..667d66ac7f 100644 --- a/src/plugins/fts/fts-expunge-log.c +++ b/src/plugins/fts/fts-expunge-log.c @@ -424,7 +424,8 @@ fts_expunge_log_read_failure(struct fts_expunge_log_read_ctx *ctx, if (ctx->input->stream_errno != 0) { ctx->failed = TRUE; - i_error("read(%s) failed: %m", ctx->log->path); + i_error("read(%s) failed: %s", ctx->log->path, + i_stream_get_error(ctx->input)); } else { size = i_stream_get_data_size(ctx->input); ctx->corrupted = TRUE;