From: Timo Sirainen Date: Wed, 6 Nov 2013 15:13:53 +0000 (+0200) Subject: dsync: Use i_stream_get_error() instead of just errno in stream error messages. X-Git-Tag: 2.2.8~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0afe75cd8ea1814ba5711196ef749f93a140c01c;p=thirdparty%2Fdovecot%2Fcore.git dsync: Use i_stream_get_error() instead of just errno in stream error messages. --- diff --git a/src/doveadm/dsync/dsync-ibc-stream.c b/src/doveadm/dsync/dsync-ibc-stream.c index ac4523854f..cf64628ef5 100644 --- a/src/doveadm/dsync/dsync-ibc-stream.c +++ b/src/doveadm/dsync/dsync-ibc-stream.c @@ -174,8 +174,8 @@ static int dsync_ibc_stream_read_mail_stream(struct dsync_ibc_stream *ibc) } while (i_stream_read(ibc->value_input) > 0); if (ibc->value_input->eof) { if (ibc->value_input->stream_errno != 0) { - errno = ibc->value_input->stream_errno; - i_error("dsync(%s): read() failed: %m", ibc->name); + i_error("dsync(%s): read() failed: %s", ibc->name, + i_stream_get_error(ibc->value_input)); dsync_ibc_stream_stop(ibc); return -1; } @@ -246,8 +246,9 @@ static int dsync_ibc_stream_send_value_stream(struct dsync_ibc_stream *ibc) i_assert(ret == -1); if (ibc->value_output->stream_errno != 0) { - i_error("dsync(%s): read(%s) failed: %m", - ibc->name, i_stream_get_name(ibc->value_output)); + i_error("dsync(%s): read(%s) failed: %s", + ibc->name, i_stream_get_name(ibc->value_output), + i_stream_get_error(ibc->value_output)); dsync_ibc_stream_stop(ibc); return -1; } @@ -371,8 +372,8 @@ static int dsync_ibc_stream_next_line(struct dsync_ibc_stream *ibc, return -1; error = t_str_new(128); if (ibc->input->stream_errno != 0) { - errno = ibc->input->stream_errno; - str_printfa(error, "read(%s) failed: %m", ibc->name); + str_printfa(error, "read(%s) failed: %s", ibc->name, + i_stream_get_error(ibc->input)); } else { i_assert(ibc->input->eof); str_printfa(error, "read(%s) failed: EOF", ibc->name); diff --git a/src/doveadm/dsync/dsync-mailbox-import.c b/src/doveadm/dsync/dsync-mailbox-import.c index 06c1fe7e24..ac0917d47b 100644 --- a/src/doveadm/dsync/dsync-mailbox-import.c +++ b/src/doveadm/dsync/dsync-mailbox-import.c @@ -299,12 +299,14 @@ dsync_istreams_cmp(struct istream *input1, struct istream *input2, int *cmp_r) } if (input1->stream_errno != 0) { errno = input1->stream_errno; - i_error("read(%s) failed: %m", i_stream_get_name(input1)); + i_error("read(%s) failed: %s", i_stream_get_name(input1), + i_stream_get_error(input1)); return -1; } if (input2->stream_errno != 0) { errno = input2->stream_errno; - i_error("read(%s) failed: %m", i_stream_get_name(input2)); + i_error("read(%s) failed: %s", i_stream_get_name(input2), + i_stream_get_error(input2)); return -1; } if (size1 == 0 && size2 == 0) @@ -1960,9 +1962,9 @@ static void dsync_mailbox_save_body(struct dsync_mailbox_importer *importer, i_assert(ret == -1); if (mail->input->stream_errno != 0) { - errno = mail->input->stream_errno; - i_error("Mailbox %s: read(msg input) failed: %m", - mailbox_get_vname(importer->box)); + i_error("Mailbox %s: read(msg input) failed: %s", + mailbox_get_vname(importer->box), + i_stream_get_error(mail->input)); mailbox_save_cancel(&save_ctx); importer->failed = TRUE; } else if (save_failed) {