Fix: compat poll: add missing empty revents checks
[lttng-tools.git] / src / bin / lttng-sessiond / main.c
index 0dbec232fe90c3dcca0e9fea4166fee09099e592..80eebf163a10af74b1edfdc1069ccd830050bdbb 100644 (file)
@@ -1090,6 +1090,11 @@ static void *thread_manage_kernel(void *data)
 
                        health_code_update();
 
+                       if (!revents) {
+                               /* No activity for this FD (poll implementation). */
+                               continue;
+                       }
+
                        /* Thread quit pipe has been closed. Killing thread. */
                        ret = sessiond_check_thread_quit_pipe(pollfd, revents);
                        if (ret) {
@@ -1235,6 +1240,11 @@ restart:
 
                health_code_update();
 
+               if (!revents) {
+                       /* No activity for this FD (poll implementation). */
+                       continue;
+               }
+
                /* Thread quit pipe has been closed. Killing thread. */
                ret = sessiond_check_thread_quit_pipe(pollfd, revents);
                if (ret) {
@@ -1362,6 +1372,11 @@ restart_poll:
 
                        health_code_update();
 
+                       if (!revents) {
+                               /* No activity for this FD (poll implementation). */
+                               continue;
+                       }
+
                        /*
                         * Thread quit pipe has been triggered, flag that we should stop
                         * but continue the current loop to handle potential data from
@@ -1538,6 +1553,11 @@ static void *thread_manage_apps(void *data)
 
                        health_code_update();
 
+                       if (!revents) {
+                               /* No activity for this FD (poll implementation). */
+                               continue;
+                       }
+
                        /* Thread quit pipe has been closed. Killing thread. */
                        ret = sessiond_check_thread_quit_pipe(pollfd, revents);
                        if (ret) {
@@ -1716,6 +1736,11 @@ static void sanitize_wait_queue(struct ust_reg_wait_queue *wait_queue)
                uint32_t revents = LTTNG_POLL_GETEV(&events, i);
                int pollfd = LTTNG_POLL_GETFD(&events, i);
 
+               if (!revents) {
+                       /* No activity for this FD (poll implementation). */
+                       continue;
+               }
+
                cds_list_for_each_entry_safe(wait_node, tmp_wait_node,
                                &wait_queue->head, head) {
                        if (pollfd == wait_node->app->sock &&
@@ -2055,6 +2080,11 @@ static void *thread_registration_apps(void *data)
                        revents = LTTNG_POLL_GETEV(&events, i);
                        pollfd = LTTNG_POLL_GETFD(&events, i);
 
+                       if (!revents) {
+                               /* No activity for this FD (poll implementation). */
+                               continue;
+                       }
+
                        /* Thread quit pipe has been closed. Killing thread. */
                        ret = sessiond_check_thread_quit_pipe(pollfd, revents);
                        if (ret) {
@@ -3918,6 +3948,11 @@ restart:
                        revents = LTTNG_POLL_GETEV(&events, i);
                        pollfd = LTTNG_POLL_GETFD(&events, i);
 
+                       if (!revents) {
+                               /* No activity for this FD (poll implementation). */
+                               continue;
+                       }
+
                        /* Thread quit pipe has been closed. Killing thread. */
                        ret = sessiond_check_thread_quit_pipe(pollfd, revents);
                        if (ret) {
@@ -4090,6 +4125,11 @@ static void *thread_manage_clients(void *data)
 
                        health_code_update();
 
+                       if (!revents) {
+                               /* No activity for this FD (poll implementation). */
+                               continue;
+                       }
+
                        /* Thread quit pipe has been closed. Killing thread. */
                        ret = sessiond_check_thread_quit_pipe(pollfd, revents);
                        if (ret) {
This page took 0.025235 seconds and 5 git commands to generate.