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:
Dmitry Frolov 2007-08-28 06:16:14 +00:00
parent a022f1e792
commit 798228cb72
2 changed files with 10 additions and 14 deletions

View File

@ -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)

View File

@ -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)