From 3cc6836b0c1155ce81d50d3dcc295380346b1e1b Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Wed, 1 Aug 2012 09:16:34 +0200 Subject: [PATCH] mysql plugin: Use the database instance name for identifying read callbacks. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The database instance is specified as argument to the block. Without this fix, we cannot specify two database blocks without the (optional!) 'Database' option as this would result in registering two read callbacks with the name 'mysql'. Thanks to Johan Bergström for reporting this on IRC! --- src/mysql.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mysql.c b/src/mysql.c index 6b636787..32b352bb 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -192,9 +192,9 @@ static int mysql_config_database (oconfig_item_t *ci) /* {{{ */ ud.data = (void *) db; ud.free_func = mysql_database_free; - if (db->database != NULL) + if (db->instance != NULL) ssnprintf (cb_name, sizeof (cb_name), "mysql-%s", - db->database); + db->instance); else sstrncpy (cb_name, "mysql", sizeof (cb_name)); -- 2.11.0