Code was using global errno.
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),
}
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));