Blob Blame History Raw
Use integer port argument with mysql_real_connect

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.

Submitted upstream: <https://github.com/OSGeo/grass/pull/3325>

diff -ur grass-8.3.1.orig/db/drivers/mysql/db.c grass-8.3.1/db/drivers/mysql/db.c
--- grass-8.3.1.orig/db/drivers/mysql/db.c	2023-10-24 21:27:44.000000000 +0200
+++ grass-8.3.1/db/drivers/mysql/db.c	2024-01-03 16:54:24.939317306 +0100
@@ -54,7 +54,9 @@
 
         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."),