Skip to content

Commit

Permalink
db_mysql: fix build for older releases
Browse files Browse the repository at this point in the history
> km_my_con.c: In function 'db_mysql_new_connection':
> km_my_con.c:132:4: warning: implicit declaration of function 'mysql_optionsv' [-Wimplicit-function-declaration]
>      mysql_optionsv(ptr->con, MYSQL_OPT_SSL_ENFORCE, (void *)&(int){1});
>      ^~~~~~~~~~~~~~
> km_my_con.c:132:29: error: 'MYSQL_OPT_SSL_ENFORCE' undeclared (first use in this function)
>     mysql_optionsv(ptr->con, MYSQL_OPT_SSL_ENFORCE, (void *)&(int){1});
>                              ^~~~~~~~~~~~~~~~~~~~~
> km_my_con.c:132:29: note: each undeclared identifier is reported only once for each function it appears in
> ../../Makefile.rules:100: recipe for target 'km_my_con.o' failed
  • Loading branch information
linuxmaniac committed Feb 2, 2024
1 parent 1fcf998 commit f0e73ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/db_mysql/km_my_con.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ struct my_con *db_mysql_new_connection(const struct db_id *id)
mysql_options(ptr->con, MYSQL_OPT_WRITE_TIMEOUT,
(const void *)&db_mysql_timeout_interval);

#if MYSQL_VERSION_ID > 50710
#ifdef MARIADB_BASE_VERSION
/*
* emulate SSL_MODE_XXXX from MySQL
Expand All @@ -141,7 +142,6 @@ struct my_con *db_mysql_new_connection(const struct db_id *id)
break;
}
#else
#if MYSQL_VERSION_ID > 50710
if(db_mysql_opt_ssl_mode != 0) {
unsigned int optuint = 0;
if(db_mysql_opt_ssl_mode == 1) {
Expand All @@ -155,14 +155,14 @@ struct my_con *db_mysql_new_connection(const struct db_id *id)
}
mysql_options(ptr->con, MYSQL_OPT_SSL_MODE, (const void *)&optuint);
}
#endif /* MARIADB_BASE_VERSION */
#else
if(db_mysql_opt_ssl_mode != 0) {
LM_WARN("ssl mode not supported by mysql version (value %u) - "
"ignoring\n",
(unsigned int)db_mysql_opt_ssl_mode);
}
#endif /* MYSQL_VERSION_ID */
#endif /* MARIADB_BASE_VERSION */

#if MYSQL_VERSION_ID > 50012
/* set reconnect flag if enabled */
Expand Down

0 comments on commit f0e73ea

Please sign in to comment.