mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
Dmitry Konyshev 1/23/09 sdr-read-fix patch to fix a crash when dumping SDRs in a file and there's an error getting an sdr. Improve algorithm for finding optimal packet size
This commit is contained in:
parent
928da786e5
commit
025f196aec
@ -2743,14 +2743,21 @@ ipmi_sdr_get_record(struct ipmi_intf * intf, struct sdr_get_rs * header,
|
||||
|
||||
rsp = intf->sendrecv(intf, &req);
|
||||
if (rsp == NULL) {
|
||||
sdr_max_read_len = sdr_rq.length - 1;
|
||||
if (sdr_max_read_len > 0) {
|
||||
/* no response may happen if requests are bridged
|
||||
and too many bytes are requested */
|
||||
continue;
|
||||
} else {
|
||||
free(data);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
switch (rsp->ccode) {
|
||||
case 0xca:
|
||||
/* read too many bytes at once */
|
||||
sdr_max_read_len = (sdr_max_read_len >> 1) - 1;
|
||||
sdr_max_read_len = sdr_rq.length - 1;
|
||||
continue;
|
||||
case 0xc5:
|
||||
/* lost reservation */
|
||||
@ -4037,6 +4044,11 @@ ipmi_sdr_dump_bin(struct ipmi_intf *intf, const char *ofile)
|
||||
sdrr->length = header->length;
|
||||
sdrr->raw = ipmi_sdr_get_record(intf, header, itr);
|
||||
|
||||
if (sdrr->raw == NULL) {
|
||||
lprintf(LOG_ERR, "ipmitool: cannot obtain SDR record %04x", header->id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (sdr_list_head == NULL)
|
||||
sdr_list_head = sdrr;
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user