@@ -322,7 +322,7 @@ void tracecmd_msg_handle_close(struct tracecmd_msg_handle *msg_handle);
/* for clients */
int tracecmd_msg_send_init_data(struct tracecmd_msg_handle *msg_handle,
- int **client_ports);
+ unsigned int **client_ports);
int tracecmd_msg_data_send(struct tracecmd_msg_handle *msg_handle,
const char *buf, int size);
int tracecmd_msg_finish_sending_data(struct tracecmd_msg_handle *msg_handle);
@@ -386,12 +386,12 @@ static int tracecmd_msg_wait_for_msg(int fd, struct tracecmd_msg *msg)
}
int tracecmd_msg_send_init_data(struct tracecmd_msg_handle *msg_handle,
- int **client_ports)
+ unsigned int **client_ports)
{
struct tracecmd_msg send_msg;
struct tracecmd_msg recv_msg;
int fd = msg_handle->fd;
- int *ports;
+ unsigned int *ports;
int i, cpus;
int ret;
@@ -74,7 +74,7 @@ static int buffers;
static int clear_function_filters;
static char *host;
-static int *client_ports;
+static unsigned int *client_ports;
static int sfd;
/* Max size to let a per cpu file get */
@@ -2545,7 +2545,7 @@ static void connect_port(int cpu)
int s;
char buf[BUFSIZ];
- snprintf(buf, BUFSIZ, "%d", client_ports[cpu]);
+ snprintf(buf, BUFSIZ, "%u", client_ports[cpu]);
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
@@ -2755,7 +2755,7 @@ static void communicate_with_listener_v1(struct tracecmd_msg_handle *msg_handle)
/* No options */
write(msg_handle->fd, "0", 2);
- client_ports = malloc(sizeof(int) * local_cpu_count);
+ client_ports = malloc(local_cpu_count * sizeof(*client_ports));
if (!client_ports)
die("Failed to allocate client ports for %d cpus", local_cpu_count);