]> 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)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Mon, 12 Mar 2018 08:42:26 +0000 (10:42 +0200)
Code was using global errno.

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

index 73261eef035331e2e111f47350c0fde16c0beba2..85003180867b8c00b8218a0322c159d03afc5dd5 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 4482729f8f964833a4b21a15ff1cf792a55abf5a..d785e906c24775c0b46ee20c4569e719888ec3d6 100644 (file)
@@ -415,7 +415,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));