Skip to content

Commit

Permalink
Cast some ignored return codes to assist static checkers
Browse files Browse the repository at this point in the history
Coverity scanning rightly warns that a usually-checked return
status was being ignored in two locations.  These two are in
cases where it's safe to ignore, so I've adjusted the code to
maintain coverage even though they are false positives here.
  • Loading branch information
natoscott committed Aug 31, 2023
1 parent e2e7d03 commit ab43e0e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pcp/Instance.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ static const char* Instance_externalName(Row* super) {
Instance* this = (Instance*) super;

if (!this->name)
pmNameInDom(InDom_getId(this), Instance_getId(this), &this->name);
/* ignore any failure here - its safe and we try again next time */
(void)pmNameInDom(InDom_getId(this), Instance_getId(this), &this->name);
return this->name;
}

Expand Down
3 changes: 2 additions & 1 deletion pcp/Metric.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ bool Metric_fetch(struct timeval* timestamp) {

void Metric_externalName(Metric metric, int inst, char** externalName) {
const pmDesc* desc = &pcp->descs[metric];
pmNameInDom(desc->indom, inst, externalName);
/* ignore a failure here - its safe to do so */
(void)pmNameInDom(desc->indom, inst, externalName);
}

int Metric_lookupText(const char* metric, char** desc) {
Expand Down

0 comments on commit ab43e0e

Please sign in to comment.