From: Pavel Rochnyack Date: Wed, 11 May 2016 21:23:01 +0000 (+0600) Subject: plugin dbi: Added lost check for udb_query_prepare_result() return value. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=e95a52352cd3f10fc7db1f3dd4bef06a28e2d780;p=collectd.git plugin dbi: Added lost check for udb_query_prepare_result() return value. --- diff --git a/src/dbi.c b/src/dbi.c index 4ef9f8c5..f37d04c9 100644 --- a/src/dbi.c +++ b/src/dbi.c @@ -547,12 +547,18 @@ static int cdbi_read_database_query(cdbi_database_t *db, /* {{{ */ sstrncpy(column_names[i], column_name, DATA_MAX_NAME_LEN); } /* }}} for (i = 0; i < column_num; i++) */ - udb_query_prepare_result( + status = udb_query_prepare_result( q, prep_area, (db->host ? db->host : hostname_g), /* plugin = */ (db->plugin_name != NULL) ? db->plugin_name : "dbi", db->name, column_names, column_num, /* interval = */ (db->interval > 0) ? db->interval : 0); + if (status != 0) + { + ERROR("dbi plugin: udb_query_prepare_result failed with status %i.", status); + BAIL_OUT (-1); + } + /* 0 = error; 1 = success; */ status = dbi_result_first_row(res); /* {{{ */ if (status != 1) {