Fix build with MariaDB 10.2 (#1470642)

This commit is contained in:
Adam Williamson 2017-07-19 11:03:20 -07:00
parent 3da2897c5e
commit cd6759e4f3
2 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,38 @@
diff -urNp old/apps/snmptrapd_sql.c new/apps/snmptrapd_sql.c
--- old/apps/snmptrapd_sql.c 2017-07-18 09:44:00.655109694 +0200
+++ new/apps/snmptrapd_sql.c 2017-07-19 12:51:14.836148821 +0200
@@ -54,6 +54,7 @@
#include <my_sys.h>
#include <mysql.h>
#include <errmsg.h>
+#include <mysql_version.h>
netsnmp_feature_require(container_fifo)
@@ -437,6 +438,7 @@ netsnmp_mysql_init(void)
return -1;
}
+#if MYSQL_VERSION_ID < 100000
#ifdef HAVE_BROKEN_LIBMYSQLCLIENT
my_init();
#else
@@ -445,6 +447,7 @@ netsnmp_mysql_init(void)
/** load .my.cnf values */
load_defaults ("my", _sql.groups, &not_argc, &not_argv);
+#endif
for(i=0; i < not_argc; ++i) {
if (NULL == not_argv[i])
continue;
@@ -542,6 +545,10 @@ netsnmp_mysql_init(void)
return -1;
}
+#if MYSQL_VERSION_ID > 100000
+ mysql_options(_sql.conn, MYSQL_READ_DEFAULT_GROUP, "snmptrapd");
+#endif
+
/** try to connect; we'll try again later if we fail */
(void) netsnmp_mysql_connect();

View File

@ -11,7 +11,7 @@
Summary: A collection of SNMP protocol tools and libraries
Name: net-snmp
Version: 5.7.3
Release: 17%{?dist}
Release: 18%{?dist}
Epoch: 1
License: BSD
@ -51,6 +51,11 @@ Patch14: net-snmp-5.7.3-Remove-U64-typedef.patch
Patch15: net-snmp-5.7.3-Fix-Makefile-PL.patch
# Use strtok_r for strtok to avoid a race condition
Patch16: net-snmp-5.7.3-strtok-r.patch
# Fix build with MariaDB 10.2
# https://sourceforge.net/p/net-snmp/bugs/2782/
# Josef's patch from https://sourceforge.net/p/net-snmp/bugs/2782/#cbed
# but with the config_os_libs2 portion removed
Patch17: net-snmp-5.7.3-mariadb102.patch
# This patch fix issue with new OpenSLL library in rawhide (f26+)
# !!!WARNING!!! DO NOT USE IT FOR OLDER FEDORA RELEASES (>f26)
@ -228,6 +233,7 @@ cp %{SOURCE12} .
%patch14 -p1 -b .U64
%patch15 -p1 -b .make
%patch16 -p1 -b .strtok-r
%patch17 -p1
%patch100 -p1 -b .openssl
%ifarch sparc64 s390 s390x
@ -536,6 +542,9 @@ rm -rf ${RPM_BUILD_ROOT}
%endif
%changelog
* Wed Jul 19 2017 Adam Williamson <awilliam@redhat.com> - 1:5.7.3-18
- Fix build with MariaDB 10.2
* Thu Jul 13 2017 Petr Pisar <ppisar@redhat.com> - 1:5.7.3-17
- perl dependency renamed to perl-interpreter
<https://fedoraproject.org/wiki/Changes/perl_Package_to_Install_Core_Modules>