summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Scherbaum <dertobi123@gentoo.org>2008-05-03 19:27:22 +0000
committerTobias Scherbaum <dertobi123@gentoo.org>2008-05-03 19:27:22 +0000
commit378edaa7bfb049188da3e0c645f183c2543d1e94 (patch)
treebf384f591272be27914946b0815e90749a133a73 /net-dns/bind/files
parentfiltered jikes (diff)
downloadgentoo-2-378edaa7bfb049188da3e0c645f183c2543d1e94.tar.gz
gentoo-2-378edaa7bfb049188da3e0c645f183c2543d1e94.tar.bz2
gentoo-2-378edaa7bfb049188da3e0c645f183c2543d1e94.zip
Fix dlz/mysql5 autoreconnect, patch by Nicolas Brousse, #180720
(Portage version: 2.1.5_rc6)
Diffstat (limited to 'net-dns/bind/files')
-rw-r--r--net-dns/bind/files/bind-dlzmysql5-reconnect.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/net-dns/bind/files/bind-dlzmysql5-reconnect.patch b/net-dns/bind/files/bind-dlzmysql5-reconnect.patch
new file mode 100644
index 000000000000..b854b9583f16
--- /dev/null
+++ b/net-dns/bind/files/bind-dlzmysql5-reconnect.patch
@@ -0,0 +1,59 @@
+--- bind-9.5.0a6.orig/contrib/dlz/drivers/dlz_mysql_driver.c 2007-02-06 06:44:26.000000000 +0100
++++ bind-9.5.0a6/contrib/dlz/drivers/dlz_mysql_driver.c 2007-09-04 23:57:57.000000000 +0200
+@@ -92,6 +92,25 @@
+ */
+
+ /*%
++ * Factorize the mysql_ping for adding a log error message
++ */
++static isc_result_t
++mysqldrv_ping(dbinstance_t *dbi) {
++ int pres = 0;
++
++ pres = mysql_ping(dbi->dbconn);
++ if ( pres != 0 ) {
++ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
++ DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(1),
++ "\nMySQL Ping Error : %s (%i)\n",
++ mysql_error(dbi->dbconn),
++ mysql_errno(dbi->dbconn));
++ return (ISC_R_FAILURE);
++ }
++ return (ISC_R_SUCCESS);
++}
++
++/*%
+ * Allocates memory for a new string, and then constructs the new
+ * string by "escaping" the input string. The new string is
+ * safe to be used in queries. This is necessary because we cannot
+@@ -225,6 +244,8 @@
+ }
+
+
++ mysqldrv_ping(dbi);
++
+ /*
+ * was a zone string passed? If so, make it safe for use in
+ * queries.
+@@ -324,7 +345,7 @@
+ qres = mysql_query((MYSQL *) dbi->dbconn, querystring);
+ if (qres == 0)
+ break;
+- for (j=0; mysql_ping((MYSQL *) dbi->dbconn) != 0 && j < 4; j++)
++ for (j=0; mysqldrv_ping(dbi) != 0 && j < 4; j++)
+ ;
+ }
+
+@@ -923,6 +944,12 @@
+ pass = getParameterValue(argv[1], "pass=");
+ socket = getParameterValue(argv[1], "socket=");
+
++ if(mysql_options((MYSQL *) dbi->dbconn, MYSQL_OPT_RECONNECT, "1")) {
++ isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
++ DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
++ "Could not set database reconnect option");
++ }
++
+ for (j=0; dbc == NULL && j < 4; j++)
+ dbc = mysql_real_connect((MYSQL *) dbi->dbconn, host,
+ user, pass, dbname, port, socket,