--- a/apps/snmptrapd_sql.c +++ b/apps/snmptrapd_sql.c @@ -54,6 +54,7 @@ #include #include #include +#include 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, ¬_argc, ¬_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(); --- a/apps/snmptrapd_sql.c +++ b/apps/snmptrapd_sql.c @@ -50,11 +50,16 @@ #undef PACKAGE_STRING #undef PACKAGE_TARNAME #undef PACKAGE_VERSION +#ifdef HAVE_BROKEN_LIBMYSQLCLIENT +#include +#include +#else #include #include #include #include #include +#endif netsnmp_feature_require(container_fifo)