]> Pileus Git - ~andy/linux/blobdiff - tools/hv/hv_vss_daemon.c
tools: hv: Check return value of poll call
[~andy/linux] / tools / hv / hv_vss_daemon.c
index 64112e19355274a15dcbe2c0b1512c9873e57c44..5febe3542f796b4559fc5a7280217502daea62f3 100644 (file)
@@ -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);