mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
Correct the misplaced recv in ipmi_lan_recv_packet() in lan and lanplus
interfaces. Patch is submitted by Ferenc Wagner (wferi at niif dot hu). Quoting his email: "The rationale is that the following code expects to use the return value of recv (ie. a byte count) not that of select (the number of file descriptors). recv should be executed anyway, that's the whole point of this snippet..." The original patch is for lan interface but it also applies to lanplus.
This commit is contained in:
parent
a022f1e792
commit
798228cb72
@ -265,14 +265,12 @@ ipmi_lan_recv_packet(struct ipmi_intf * intf)
|
||||
tmout.tv_usec = 0;
|
||||
|
||||
ret = select(intf->fd + 1, &read_set, NULL, &err_set, &tmout);
|
||||
if (ret < 0) {
|
||||
if (FD_ISSET(intf->fd, &err_set) || !FD_ISSET(intf->fd, &read_set))
|
||||
return NULL;
|
||||
if (ret < 0 || FD_ISSET(intf->fd, &err_set) || !FD_ISSET(intf->fd, &read_set))
|
||||
return NULL;
|
||||
|
||||
ret = recv(intf->fd, &rsp.data, IPMI_BUF_SIZE, 0);
|
||||
if (ret < 0)
|
||||
return NULL;
|
||||
}
|
||||
ret = recv(intf->fd, &rsp.data, IPMI_BUF_SIZE, 0);
|
||||
if (ret < 0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ret == 0)
|
||||
|
@ -425,14 +425,12 @@ ipmi_lan_recv_packet(struct ipmi_intf * intf)
|
||||
tmout.tv_usec = 0;
|
||||
|
||||
ret = select(intf->fd + 1, &read_set, NULL, &err_set, &tmout);
|
||||
if (ret < 0) {
|
||||
if (FD_ISSET(intf->fd, &err_set) || !FD_ISSET(intf->fd, &read_set))
|
||||
return NULL;
|
||||
if (ret < 0 || FD_ISSET(intf->fd, &err_set) || !FD_ISSET(intf->fd, &read_set))
|
||||
return NULL;
|
||||
|
||||
ret = recv(intf->fd, &rsp.data, IPMI_BUF_SIZE, 0);
|
||||
if (ret < 0)
|
||||
return NULL;
|
||||
}
|
||||
ret = recv(intf->fd, &rsp.data, IPMI_BUF_SIZE, 0);
|
||||
if (ret < 0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ret == 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user