Add a safety check to nbfd of apps cmd pollfd
[lttng-tools.git] / ltt-sessiond / main.c
index c9522d697f5cc698217b94dc495312af7ee9c7d2..436ee9f167e8a45853fe9b58557555de74b82629 100644 (file)
@@ -880,6 +880,15 @@ static int update_apps_cmd_pollfd(unsigned int nb_fd, unsigned int old_nb_fd,
                }
        }
 
+       if (nb_fd < 2) {
+               /*
+                * There should *always* be at least two fds in the pollfd. This safety
+                * check make sure the poll() will actually try on those two pipes at
+                * best which are the thread_quit_pipe and apps_cmd_pipe.
+                */
+               nb_fd = 2;
+       }
+
        /* Destroy old pollfd */
        free(old_pollfd);
 
This page took 0.02399 seconds and 4 git commands to generate.