helper_thread: Complain if select() fails
authorBart Van Assche <bvanassche@acm.org>
Sat, 4 Jan 2020 21:59:02 +0000 (13:59 -0800)
committerBart Van Assche <bvanassche@acm.org>
Sat, 4 Jan 2020 22:39:41 +0000 (14:39 -0800)
This patch suppresses the following Coverity complaint:

CID 280687:  Error handling issues  (CHECKED_RETURN)
Calling "select(1, &rfds, NULL, &efds, &timeout)" without checking return
value. This library function may fail and return an error code.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
helper_thread.c

index ad2e83b4e18f8812642683a8358d8a8ccd71d9b1..7874985504be2aa6c4c82c7683320c39409d927d 100644 (file)
@@ -176,7 +176,10 @@ static void *helper_thread_main(void *data)
                        FD_SET(hd->pipe[0], &rfds);
                        FD_ZERO(&efds);
                        FD_SET(hd->pipe[0], &efds);
-                       select(1, &rfds, NULL, &efds, &timeout);
+                       ret = select(1, &rfds, NULL, &efds, &timeout);
+                       if (ret < 0)
+                               log_err("fio: select() call in helper thread failed: %s",
+                                       strerror(errno));
                        if (read_from_pipe(hd->pipe[0], &action, sizeof(action)) <
                            0)
                                action = 0;