]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: server: Use the stream_errno to evaluate output stream errors.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Fri, 16 Feb 2018 08:34:48 +0000 (09:34 +0100)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Fri, 16 Feb 2018 22:06:34 +0000 (23:06 +0100)
Code was using global errno.

src/lib-smtp/smtp-server-connection.c
src/lib-smtp/smtp-server-reply.c

index 56b7c2b10ef08c4c35a963d2734b4ea148b73012..eeeecddb1eb372de5e46a2752672eb1d27fa3eb6 100644 (file)
@@ -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),
index 6c034f3207b2ab21a8bdb4574e1fe53aa8ebab97..0663ecdf9fdbbfdda515e2de6f1c0e4d066cf1cc 100644 (file)
@@ -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));