Skip to content

Commit

Permalink
Use integer port argument with mysql_real_connect
Browse files Browse the repository at this point in the history
The port argument is not a string, but a plain integer.  In the past,
compilers ignore such type errors and produced a warning only, but
this is changing, so this change also addresses a potential build
failure.
  • Loading branch information
fweimer-rh committed Jan 3, 2024
1 parent e4431cc commit 1346bda
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion db/drivers/mysql/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ int db__driver_open_database(dbHandle *handle)

connection = mysql_init(NULL);
res = mysql_real_connect(connection, host, user, password,
connpar.dbname, port, NULL, 0);
connpar.dbname,
port != NULL ? atoi(port) : 0,
NULL, 0);

if (res == NULL) {
db_d_append_error("%s\n%s", _("Connection failed."),
Expand Down

0 comments on commit 1346bda

Please sign in to comment.