Skip to content

Commit

Permalink
lib-smtp: server: Use the stream_errno to evaluate output stream errors.
Browse files Browse the repository at this point in the history
Code was using global errno.
  • Loading branch information
stephanbosch committed Feb 16, 2018
1 parent 8c2d916 commit 5c76836
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/lib-smtp/smtp-server-connection.c
Expand Up @@ -689,7 +689,8 @@ int smtp_server_connection_flush(struct smtp_server_connection *conn)

if ((ret = o_stream_flush(output)) <= 0) {
if (ret < 0) {
if (errno != EPIPE && errno != ECONNRESET) {
if (output->stream_errno != EPIPE &&
output->stream_errno != ECONNRESET) {
smtp_server_connection_error(conn,
"Connection lost: write(%s) failed: %s",
o_stream_get_name(output),
Expand Down
3 changes: 2 additions & 1 deletion src/lib-smtp/smtp-server-reply.c
Expand Up @@ -425,7 +425,8 @@ static int smtp_server_reply_send_real(struct smtp_server_reply *reply,
}

if (o_stream_send(output, str_data(textbuf), str_len(textbuf)) < 0) {
if (errno != EPIPE && errno != ECONNRESET) {
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));
Expand Down

0 comments on commit 5c76836

Please sign in to comment.