From a686277c725074ac3966396548789cd13fce3833 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Sun, 24 Oct 2021 22:47:50 +0300 Subject: [PATCH] IPCDevice: check value returned from select() Change-Id: I1c823317659547bb2391c57ac4d7931de1a383e3 Fxies: CID#240744 --- Transceiver52M/device/ipc/IPCDevice.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Transceiver52M/device/ipc/IPCDevice.cpp b/Transceiver52M/device/ipc/IPCDevice.cpp index c1c64495..2e40aa35 100644 --- a/Transceiver52M/device/ipc/IPCDevice.cpp +++ b/Transceiver52M/device/ipc/IPCDevice.cpp @@ -839,6 +839,7 @@ void IPCDevice::manually_poll_sock_fds() { struct timeval wait = { 0, 100000 }; fd_set crfds, cwfds; + char err_buf[256]; int max_fd = 0; FD_ZERO(&crfds); @@ -853,7 +854,11 @@ void IPCDevice::manually_poll_sock_fds() 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++) { int flags = 0;