Skip to content

Commit

Permalink
Use the instance_id as returned by pmdaCacheLookup*
Browse files Browse the repository at this point in the history
  • Loading branch information
pcolby committed Apr 6, 2015
1 parent e3d1f8e commit 1d5e544
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions include/pcp-cpp/cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,13 @@ lookup_result_type<Type> lookup(const pmInDom indom, const std::string &name,
lookup_result_type<Type> result;
void * opaque;
int instance_id;
result.instance_id = PM_ID_NULL;
result.status = pmdaCacheLookupName(indom, name.c_str(), &instance_id, &opaque);
if (result.status < 0) {
throw pcp::exception(result.status);
}
if ((flags & require_active) && (result.status != PMDA_CACHE_ACTIVE)) {
std::ostringstream message;
message << "Cache entry " << indom << ':' << result.instance_id
message << "Cache entry " << indom << ':' << instance_id
<< " (\"" << name << "\") inactive";
throw pcp::exception(result.status, message.str());
}
Expand Down Expand Up @@ -184,7 +183,7 @@ lookup_result_type<Type> lookup(const pmInDom indom, const std::string &name,
}
if ((flags & require_active) && (result.status != PMDA_CACHE_ACTIVE)) {
std::ostringstream message;
message << "Cache entry " << indom << ':' << result.instance_id
message << "Cache entry " << indom << ':' << instance_id
<< " (\"" << name << "\":\"" << key << "\") inactive";
throw pcp::exception(result.status, message.str());
}
Expand Down

0 comments on commit 1d5e544

Please sign in to comment.