Skip to content

Commit

Permalink
sources/tls.c: eof error text improve
Browse files Browse the repository at this point in the history
When errno is 0, it means that client closed the connection

Signed-off-by: rkhapov <[email protected]>
(cherry picked from commit e4021d359980ed8e6cb86271672a0895e7aa5ae7)
Signed-off-by: rkhapov <[email protected]>
  • Loading branch information
rkhapov committed Nov 18, 2024
1 parent f081cf9 commit ce2e310
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion third_party/machinarium/sources/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@ static inline void mm_tls_error(mm_io_t *io, int ssl_rc, char *fmt, ...)
} else if (ssl_rc == 0) {
error_str = "unexpected EOF (connection reset)";
} else if (ssl_rc < 0) {
error_str = strerror(mm_errno_get());
int errno_ = mm_errno_get();
if (errno_ != 0) {
error_str = strerror(errno_);
} else {
error_str = "no bio underlying error (client closed the connection?)";
}
}

/* error message */
Expand Down

0 comments on commit ce2e310

Please sign in to comment.