Skip to content

Commit d29a025

Browse files
ligurioTotktonada
authored andcommitted
client: fix a comparison of messages
curl's commit 5e259d7b ("pingpong: extend the response reading error with errno") added errno to the message and this breaks comparison of messages and thus smtp module returns wrong exit code. Patch fixes that. Fixes #70 Follows up curl/curl#9443
1 parent 4ec0b4d commit d29a025

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

smtp/smtpc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,12 @@ smtpc_execute(struct smtpc_request *req, double timeout)
467467
* leads to a message about failed response reading but
468468
* response code stays 250, that is not correct. See
469469
* https://github.com/curl/curl/issues/8356
470+
*
471+
* NOTE: An error message could contain an errno,
472+
* so we comparing start bytes only.
470473
*/
471-
if (strcmp(req->error_buf, "response reading failed") == 0) {
474+
const char msg_prefix[] = "response reading failed";
475+
if (strncmp(req->error_buf, msg_prefix, sizeof(msg_prefix) - 1) == 0) {
472476
req->status = -1;
473477
}
474478
req->reason = req->error_buf;

0 commit comments

Comments
 (0)