From bd873535128d9e5a459def6977772d4b68934c90 Mon Sep 17 00:00:00 2001 From: Daniel Lenski Date: Tue, 5 Dec 2023 15:55:24 -0800 Subject: [PATCH] Remove unreachable code section Based on Sergei Golubchik's question about this code section in https://github.com/mariadb-corporation/mariadb-connector-c/pull/223#issuecomment-1773728383, eventually culminating in the conclusion that it's literally impossible to reach this code section based on the types and signedess of the variables involved: https://github.com/mariadb-corporation/mariadb-connector-c/pull/223#issuecomment-1854720364 All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc. --- libmariadb/mariadb_lib.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/libmariadb/mariadb_lib.c b/libmariadb/mariadb_lib.c index 587ac542c..9a79e8551 100644 --- a/libmariadb/mariadb_lib.c +++ b/libmariadb/mariadb_lib.c @@ -1820,17 +1820,6 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user, mysql->protocol_version= end[0]; end++; - /* Check if server sends an error */ - if (mysql->protocol_version == 0XFF) - { - net_get_error(end, pkt_length - 1, net->last_error, sizeof(net->last_error), - &net->last_errno, net->sqlstate); - /* fix for bug #26426 */ - if (net->last_errno == 1040) - memcpy(net->sqlstate, "08004", SQLSTATE_LENGTH); - goto error; - } - if (mysql->protocol_version < PROTOCOL_VERSION) { net->last_errno= CR_VERSION_ERROR;