[collectd] [PATCH] postgresql plugin: Fixed the expansion of the "hostname" parameter.

Sebastian Harl sh at tokkee.org
Wed Jul 23 14:29:56 CEST 2008


If the configured hostname specifies a UNIX domain socket, the parameter now
expands to "localhost" as described earlier.

Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
 src/postgresql.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/postgresql.c b/src/postgresql.c
index 8aa3de7..5bf0614 100644
--- a/src/postgresql.c
+++ b/src/postgresql.c
@@ -346,7 +346,8 @@ static int c_psql_exec_query (c_psql_database_t *db, int idx)
 	for (i = 0; i < query->params_num; ++i) {
 		switch (query->params[i]) {
 			case C_PSQL_PARAM_HOST:
-				params[i] = (NULL == db->host) ? "localhost" : db->host;
+				params[i] = C_PSQL_IS_UNIX_DOMAIN_SOCKET (db->host)
+					? "localhost" : db->host;
 				break;
 			case C_PSQL_PARAM_DB:
 				params[i] = db->database;
-- 
1.5.6.1.156.ge903b

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20080723/5c531972/attachment.pgp 


More information about the collectd mailing list