Skip to content

Commit 3e43606

Browse files
committed
MDEV-36701 command line client doesn't check session_track information (fix)
Corrects clang Wvargs warning: client/mysql.cc:3205:16: warning: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Wvarargs] Because there is only one mode we are interested in that is tested before the varargs this is safe to do.
1 parent 3ad4027 commit 3e43606

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

client/mysql.cc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3199,20 +3199,17 @@ static int reconnect(void)
31993199
}
32003200

32013201
#ifndef EMBEDDED_LIBRARY
3202-
static void status_info_cb(void *data, enum enum_mariadb_status_info type, ...)
3202+
static void status_info_cb(void *data, enum enum_mariadb_status_info type,
3203+
enum enum_session_state_type state_type, MARIADB_CONST_STRING *val)
32033204
{
3204-
va_list ap;
3205-
va_start(ap, type);
3206-
if (type == SESSION_TRACK_TYPE && va_arg(ap, int) == SESSION_TRACK_SCHEMA)
3205+
if (type == SESSION_TRACK_TYPE && state_type == SESSION_TRACK_SCHEMA)
32073206
{
3208-
MARIADB_CONST_STRING *val= va_arg(ap, MARIADB_CONST_STRING *);
32093207
my_free(current_db);
32103208
if (val->length)
32113209
current_db= my_strndup(PSI_NOT_INSTRUMENTED, val->str, val->length, MYF(MY_FAE));
32123210
else
32133211
current_db= NULL;
32143212
}
3215-
va_end(ap);
32163213
}
32173214
#else
32183215
#define mysql_optionsv(A,B,C,D) do { } while(0)

0 commit comments

Comments
 (0)