Description: Do not redefine my_bool when the client library already provides it
 MariaDB Connector/C (pulled in through default-libmysqlclient-dev) still
 defines my_bool as a typedef in its mysql.h, so the unconditional
 "typedef bool my_bool;" that was added for MySQL 8 clashes with it and
 breaks the w1retap-mysql plugin build.  Only define my_bool when building
 against MySQL 8.0 or later client headers, which removed the typedef.
Author: tangxiaofeng <tangxiaofeng@kylinos.cn>
Forwarded: not-needed
Last-Update: 2026-09-16

--- w1retap-1.5.5.orig/src/mysql/w1mysql.c
+++ w1retap-1.5.5/src/mysql/w1mysql.c
@@ -26,7 +26,13 @@
 #include <time.h>
 #include <sys/file.h>
 #include <mysql.h>
+/* MySQL 8.0 and later removed my_bool from the client headers, while
+ * MariaDB Connector/C (and older MySQL) still provide it.  Only define
+ * our own my_bool when the client library does not supply one. */
+#if defined(MYSQL_VERSION_ID) && MYSQL_VERSION_ID >= 80000 && \
+    !defined(MARIADB_BASE_VERSION) && !defined(MARIADB_VERSION_ID)
 typedef bool my_bool;
+#endif
 #include <syslog.h>
 #include "w1retap.h"
 
