Code

postgresql plugin: Fixed the expansion of the "hostname" parameter.
[collectd.git] / src / postgresql.c
index d65a66fd04d0bd8e033c28486c08156588f07c8d..f2d7665ff785a09f92ddfb978b9aa3dd4b7bd84c 100644 (file)
@@ -345,7 +345,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;