mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-15 02:57:49 +00:00
tools: hv: Check return value of poll call
Check return value of poll call and if it fails print error to the system log. If errno is EINVAL then exit with non-zero value otherwise continue the while loop and call poll again. Signed-off-by: Tomas Hozza <thozza@redhat.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
5c28926981
commit
9561d47931
1 changed files with 10 additions and 1 deletions
|
@ -200,7 +200,16 @@ int main(void)
|
||||||
socklen_t addr_l = sizeof(addr);
|
socklen_t addr_l = sizeof(addr);
|
||||||
pfd.events = POLLIN;
|
pfd.events = POLLIN;
|
||||||
pfd.revents = 0;
|
pfd.revents = 0;
|
||||||
poll(&pfd, 1, -1);
|
|
||||||
|
if (poll(&pfd, 1, -1) < 0) {
|
||||||
|
syslog(LOG_ERR, "poll failed; error:%d %s", errno, strerror(errno));
|
||||||
|
if (errno == EINVAL) {
|
||||||
|
close(fd);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
len = recvfrom(fd, vss_recv_buffer, sizeof(vss_recv_buffer), 0,
|
len = recvfrom(fd, vss_recv_buffer, sizeof(vss_recv_buffer), 0,
|
||||||
addr_p, &addr_l);
|
addr_p, &addr_l);
|
||||||
|
|
Loading…
Add table
Reference in a new issue