Fix: consumerd: type confusion in lttng_consumer_send_error
[lttng-tools.git] / src / bin / lttng-sessiond / manage-consumer.c
index c87a43f6e1315cab8289c3e52bff0555b68b90e1..6980dfa33f5931af96b1e145e3e11613a4d3f9a8 100644 (file)
@@ -1,20 +1,10 @@
 /*
- * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
- *                      Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *               2013 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ * Copyright (C) 2011 EfficiOS Inc.
+ * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ * Copyright (C) 2013 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2 only,
- * as published by the Free Software Foundation.
+ * SPDX-License-Identifier: GPL-2.0-only
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <signal.h>
@@ -61,7 +51,7 @@ static void wait_until_thread_is_ready(struct thread_notifiers *notifiers)
 /*
  * This thread manage the consumer error sent back to the session daemon.
  */
-void *thread_consumer_management(void *data)
+static void *thread_consumer_management(void *data)
 {
        int sock = -1, i, ret, pollfd, err = -1, should_quit = 0;
        uint32_t revents, nb_fd;
@@ -171,9 +161,13 @@ void *thread_consumer_management(void *data)
 
        DBG2("Receiving code from consumer err_sock");
 
-       /* Getting status code from kconsumerd */
-       ret = lttcomm_recv_unix_sock(sock, &code,
-                       sizeof(enum lttcomm_return_code));
+       /* Getting status code from consumerd */
+       {
+               int32_t comm_code = 0;
+
+               ret = lttcomm_recv_unix_sock(sock, &comm_code, sizeof(comm_code));
+               code = (typeof(code)) comm_code;
+       }
        if (ret <= 0) {
                mark_thread_intialization_as_failed(notifiers);
                goto error;
@@ -318,9 +312,14 @@ void *thread_consumer_management(void *data)
                                        goto error;
                                }
                                health_code_update();
-                               /* Wait for any kconsumerd error */
-                               ret = lttcomm_recv_unix_sock(sock, &code,
-                                               sizeof(enum lttcomm_return_code));
+                               /* Wait for any consumerd error */
+                               {
+                                       int32_t comm_code = 0;
+
+                                       ret = lttcomm_recv_unix_sock(
+                                               sock, &comm_code, sizeof(comm_code));
+                                       code = (typeof(code)) comm_code;
+                               }
                                if (ret <= 0) {
                                        ERR("consumer closed the command socket");
                                        goto error;
This page took 0.02444 seconds and 4 git commands to generate.