Fix: relayd send_command() util not logging on failure
[lttng-tools.git] / src / common / relayd / relayd.c
index c46290d1a2978f205dbf7e07d903a0d428f405fd..7e6520d29f51d3c9f8dbd4781d9383fa4fbbb829 100644 (file)
@@ -35,7 +35,7 @@
  * Send command. Fill up the header and append the data.
  */
 static int send_command(struct lttcomm_relayd_sock *rsock,
-               enum lttcomm_relayd_command cmd, void *data, size_t size,
+               enum lttcomm_relayd_command cmd, const void *data, size_t size,
                int flags)
 {
        int ret;
@@ -72,14 +72,14 @@ static int send_command(struct lttcomm_relayd_sock *rsock,
                memcpy(buf + sizeof(header), data, size);
        }
 
+       DBG3("Relayd sending command %d of size %" PRIu64, (int) cmd, buf_size);
        ret = rsock->sock.ops->sendmsg(&rsock->sock, buf, buf_size, flags);
        if (ret < 0) {
+               PERROR("Failed to send command %d of size %" PRIu64,
+                               (int) cmd, buf_size);
                ret = -errno;
                goto error;
        }
-
-       DBG3("Relayd sending command %d of size %" PRIu64, cmd, buf_size);
-
 error:
        free(buf);
 alloc_error:
This page took 0.025614 seconds and 5 git commands to generate.