Skip to content

Commit eb86bdf

Browse files
committed
Cast some ignored return codes to assist static checkers
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.
1 parent 5d47e2c commit eb86bdf

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

pcp/Instance.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ static const char* Instance_externalName(Row* super) {
8181
Instance* this = (Instance*) super;
8282

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

pcp/Metric.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ bool Metric_fetch(struct timeval* timestamp) {
182182

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

188189
int Metric_lookupText(const char* metric, char** desc) {

0 commit comments

Comments
 (0)