From a3334c42b27f88d7ef4410003b297e95d8da5675 Mon Sep 17 00:00:00 2001 From: Paul Colby Date: Fri, 10 Apr 2015 21:31:56 +1000 Subject: [PATCH] Don't exit pcp::pmda::on_store too early This fixes a bug, correctly identified by Coverity Scane (issue 89192), in which the pcp::pmda::store function incorrectly returns success after checking just one metric to be set, not *all* metrics specified. Also corrected a doxygen comment, which has not been correct since the pcp::pmda::on_store function was first fleshed out (ie no longer just a stub). --- include/pcp-cpp/pmda.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pcp-cpp/pmda.hpp b/include/pcp-cpp/pmda.hpp index 965bdbd..909eba3 100644 --- a/include/pcp-cpp/pmda.hpp +++ b/include/pcp-cpp/pmda.hpp @@ -1114,7 +1114,7 @@ class pmda { return pmdaProfile(prof, pmda); } - /// @brief Store a value into a metric. This is a no-op. + /// @brief Store a value into a metric. virtual int on_store(pmResult *result, pmdaExt *pmda) { __pmNotifyErr(LOG_INFO, "on store"); @@ -1148,9 +1148,9 @@ class pmda { } else { store_value(id, value_set->vlist[instance_index].value.pval); } - return 0; // >= 0 implies success. } } + return 0; // >= 0 implies success. } catch (const pcp::exception &ex) { if (ex.error_code() != PMDA_FETCH_NOVALUES) { __pmNotifyErr(LOG_ERR, "%s", ex.what());