aboutsummaryrefslogtreecommitdiff
path: root/src/mysql.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mysql.c')
-rw-r--r--src/mysql.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/mysql.c b/src/mysql.c
index 676618a..81ea62c 100644
--- a/src/mysql.c
+++ b/src/mysql.c
@@ -125,4 +125,4 @@ mysql_db_open (void **dp, ANUBIS_URL * url, enum anubis_db_mode mode,
const char *rcfile = anubis_url_get_arg (url, "rcfile");
- const char *portstr = anubis_url_get_arg (url, "port");
- const char *s = anubis_url_get_arg (url, "bufsize");
+ const char *s;
+ char *optfile;
int port = 0;
@@ -143,2 +143,3 @@ mysql_db_open (void **dp, ANUBIS_URL * url, enum anubis_db_mode mode,
+ s = anubis_url_get_arg (url, "bufsize");
if (s)
@@ -154,6 +155,7 @@ mysql_db_open (void **dp, ANUBIS_URL * url, enum anubis_db_mode mode,
- if (portstr)
+ s = anubis_url_get_arg (url, "port");
+ if (s)
{
char *p;
- port = strtoul (portstr, &p, 10);
+ port = strtoul (s, &p, 10);
if (*p)
@@ -171,2 +173,15 @@ mysql_db_open (void **dp, ANUBIS_URL * url, enum anubis_db_mode mode,
mysql_init (&mdata->mysql);
+
+ s = anubis_url_get_arg (url, "options-file");
+ if (!s) {
+ if (access ("/etc/my.cnf", F_OK) == 0)
+ s = "/etc/my.cnf";
+ }
+
+ if (s && *s) {
+ mysql_options (&mdata->mysql, MYSQL_READ_DEFAULT_FILE, s);
+ mysql_options(&mdata->mysql, MYSQL_READ_DEFAULT_GROUP,
+ s ? s : "anubis");
+ }
+
if (!mysql_real_connect (&mdata->mysql,

Return to:

Send suggestions and report system problems to the System administrator.