Skip to content

Commit

Permalink
Don't exit pcp::pmda::on_store too early
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
pcolby committed Apr 10, 2015
1 parent cfe3467 commit a3334c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/pcp-cpp/pmda.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit a3334c4

Please sign in to comment.