IPCDevice: check value returned from select()

Change-Id: I1c823317659547bb2391c57ac4d7931de1a383e3
Fxies: CID#240744
This commit is contained in:
Vadim Yanitskiy 2021-10-24 22:47:50 +03:00
parent 683f140739
commit a686277c72
1 changed files with 6 additions and 1 deletions

View File

@ -839,6 +839,7 @@ void IPCDevice::manually_poll_sock_fds()
{ {
struct timeval wait = { 0, 100000 }; struct timeval wait = { 0, 100000 };
fd_set crfds, cwfds; fd_set crfds, cwfds;
char err_buf[256];
int max_fd = 0; int max_fd = 0;
FD_ZERO(&crfds); FD_ZERO(&crfds);
@ -853,7 +854,11 @@ void IPCDevice::manually_poll_sock_fds()
FD_SET(curr_fd->fd, &cwfds); FD_SET(curr_fd->fd, &cwfds);
} }
select(max_fd + 1, &crfds, &cwfds, 0, &wait); if (select(max_fd + 1, &crfds, &cwfds, 0, &wait) < 0) {
LOGP(DDEV, LOGL_ERROR, "select() failed: %s\n",
strerror_r(errno, err_buf, sizeof(err_buf)));
return;
}
for (unsigned int i = 0; i < chans; i++) { for (unsigned int i = 0; i < chans; i++) {
int flags = 0; int flags = 0;