Add a safety check to nbfd of apps cmd pollfd
authorDavid Goulet <david.goulet@polymtl.ca>
Wed, 7 Sep 2011 19:50:08 +0000 (15:50 -0400)
committerDavid Goulet <david.goulet@polymtl.ca>
Wed, 7 Sep 2011 19:50:08 +0000 (15:50 -0400)
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
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.027976 seconds and 5 git commands to generate.