Fix: compat poll: add missing empty revents checks
[lttng-tools.git] / src / bin / lttng-consumerd / health-consumerd.c
index ad2b5245a849f769d295f5a51464c973f1145b5b..fc9a266653f2361efe3a4987bd2640e125761d8c 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #define _GNU_SOURCE
+#define _LGPL_SOURCE
 #include <fcntl.h>
 #include <getopt.h>
 #include <grp.h>
@@ -260,6 +261,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 = check_health_quit_pipe(pollfd, revents);
                        if (ret) {
@@ -303,7 +309,7 @@ restart:
 
                assert(msg.cmd == HEALTH_CMD_CHECK);
 
-               reply.ret_code = 0;
+               memset(&reply, 0, sizeof(reply));
                for (i = 0; i < NR_HEALTH_CONSUMERD_TYPES; i++) {
                        /*
                         * health_check_state return 0 if thread is in
@@ -314,7 +320,7 @@ restart:
                        }
                }
 
-               DBG2("Health check return value %" PRIx64, reply.ret_code);
+               DBG("Health check return value %" PRIx64, reply.ret_code);
 
                ret = send_unix_sock(new_sock, (void *) &reply, sizeof(reply));
                if (ret < 0) {
This page took 0.023794 seconds and 4 git commands to generate.