X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=liblttkconsumerd%2Fliblttkconsumerd.c;h=9ad380c8dab5e8c1be679a0881890e929f355c57;hp=1d69a4c463faffc1fa764141e287f725a625c535;hb=ca3c5ac0cf100d80352a1a81936b5adc47942f35;hpb=159c7ff4ea99cd808f89787f66a23152483137d4 diff --git a/liblttkconsumerd/liblttkconsumerd.c b/liblttkconsumerd/liblttkconsumerd.c index 1d69a4c46..9ad380c8d 100644 --- a/liblttkconsumerd/liblttkconsumerd.c +++ b/liblttkconsumerd/liblttkconsumerd.c @@ -177,6 +177,7 @@ static int kconsumerd_add_fd(struct lttcomm_kconsumerd_msg *buf, int consumerd_f tmp_fd->state = buf->state; tmp_fd->max_sb_size = buf->max_sb_size; strncpy(tmp_fd->path_name, buf->path_name, PATH_MAX); + tmp_fd->path_name[PATH_MAX - 1] = '\0'; /* Opening the tracefile in write mode */ ret = open(tmp_fd->path_name, @@ -597,12 +598,8 @@ static int kconsumerd_consumerd_recv_fd(int sfd, nb_fd = size / sizeof(struct lttcomm_kconsumerd_msg); /* - * Note: only supporting receiving one FD at a time for now. - * This code needs fixing if we wish to receive more (a single - * receive for the whole fd batch rather than one per fd). + * nb_fd is the number of fds we receive. One fd per recvmsg. */ - assert(nb_fd == 1); - for (i = 0; i < nb_fd; i++) { struct msghdr msg = { 0 }; @@ -1008,7 +1005,7 @@ end: */ void kconsumerd_cleanup(void) { - struct kconsumerd_fd *iter; + struct kconsumerd_fd *iter, *tmp; /* remove the socket file */ unlink(kconsumerd_command_sock_path); @@ -1018,7 +1015,7 @@ void kconsumerd_cleanup(void) * running (after joining on the threads), no need to protect * list iteration with mutex. */ - cds_list_for_each_entry(iter, &kconsumerd_data.fd_list.head, list) { + cds_list_for_each_entry_safe(iter, tmp, &kconsumerd_data.fd_list.head, list) { kconsumerd_del_fd(iter); } }