X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=ltt-sessiond%2Fmain.c;h=436ee9f167e8a45853fe9b58557555de74b82629;hp=c9522d697f5cc698217b94dc495312af7ee9c7d2;hb=733bb3da0f1ef5005ffe5df7811875e737cb3414;hpb=28ba3f4e591845d044b329db5ac80e9558ed1fc8 diff --git a/ltt-sessiond/main.c b/ltt-sessiond/main.c index c9522d697..436ee9f16 100644 --- a/ltt-sessiond/main.c +++ b/ltt-sessiond/main.c @@ -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);