diff options
author | Tomas Hozza <thozza@redhat.com> | 2013-06-27 15:52:49 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-27 03:40:41 +0400 |
commit | 9561d479314f16b41563f73511fb61d91de4642f (patch) | |
tree | b5d65509e4ba9f851fc0402fabb68b1363023d69 | |
parent | 5c2892698184bf82e1f7d5c557ad81c9570b569a (diff) | |
download | linux-9561d479314f16b41563f73511fb61d91de4642f.tar.xz |
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>
-rw-r--r-- | tools/hv/hv_vss_daemon.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/hv/hv_vss_daemon.c b/tools/hv/hv_vss_daemon.c index 64112e193552..5febe3542f79 100644 --- a/tools/hv/hv_vss_daemon.c +++ b/tools/hv/hv_vss_daemon.c @@ -200,7 +200,16 @@ int main(void) socklen_t addr_l = sizeof(addr); pfd.events = POLLIN; 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, addr_p, &addr_l); |