#! /bin/sh /usr/share/dpatch/dpatch-run ## 004-reconnect.dpatch by Matej Vela ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Automatically re-establish connections with MySQL 5.0.3+. @DPATCH@ diff -urNad libapache-mod-auth-mysql-4.3.9~/mod_auth_mysql.c libapache-mod-auth-mysql-4.3.9/mod_auth_mysql.c --- libapache-mod-auth-mysql-4.3.9~/mod_auth_mysql.c 2008-02-12 15:33:56.000000000 +0100 +++ libapache-mod-auth-mysql-4.3.9/mod_auth_mysql.c 2008-02-12 15:43:30.000000000 +0100 @@ -1092,6 +1092,9 @@ char *dbname = auth_db_name, *user = auth_db_user, *pwd = auth_db_pwd; void (*sigpipe_handler)(); unsigned long client_flag = 0; +#if MYSQL_VERSION_ID >= 50013 + my_bool do_reconnect = 1; +#endif APACHELOG(APLOG_DEBUG, r, "Opening DB connection for %s", sec->dir); @@ -1160,6 +1163,13 @@ return errno; } +#if MYSQL_VERSION_ID >= 50013 + /* The default is no longer to automatically reconnect on failure, + * (as of 5.0.3) so we have to set that option here. The option is + * available from 5.0.13. */ + mysql_options(sec->dbh, MYSQL_OPT_RECONNECT, &do_reconnect); +#endif + signal(SIGPIPE, sigpipe_handler); APACHELOG(APLOG_DEBUG, r, "Persistent in %s is %i", sec->dir, sec->persistent);