ID: 3576212 - 'lib/ipmi_event.c' - better rsp handling

Commit changes handling of response in ipmi_event_fromsensor(). If ccode doesn't
equal to 0, then error message is printed and function returns.

Reported-by: Duncan Idaho
This commit is contained in:
Zdenek Styblik 2013-03-14 05:29:50 +00:00
parent 95df7b2499
commit e320e266b1

View File

@ -346,8 +346,15 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
rsp = ipmi_sdr_get_sensor_thresholds(intf, emsg.sensor_num,
target, lun, channel);
if (rsp != NULL && rsp->ccode == 0) {
if (rsp == NULL) {
lprintf(LOG_ERR,
"Command Get Sensor Thresholds failed: invalid response.");
return (-1);
} else if (rsp->ccode != 0) {
lprintf(LOG_ERR, "Command Get Sensor Thresholds failed: %s",
val2str(rsp->ccode, completion_code_vals));
return (-1);
}
/* threshold reading */
emsg.event_data[2] = rsp->data[(emsg.event_data[0] / 2) + 1];
@ -376,7 +383,6 @@ ipmi_event_fromsensor(struct ipmi_intf * intf, char * id, char * state, char * e
/* trigger in byte 2, threshold in byte 3 */
emsg.event_data[0] |= 0x50;
}
}
break;
/*