X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=formats%2Flttng-live%2Flttng-live-functions.c;h=2d923618d2326fa707a32096aad1b80f26f2f744;hb=0c3cd7e149e97560c18d807d54bd038a401ff778;hp=34612cf7b59f4e2fc5bca704a962d602b313fdc5;hpb=4a74436710b248274ffe9e038da0bd41af8a3d8d;p=babeltrace.git diff --git a/formats/lttng-live/lttng-live-functions.c b/formats/lttng-live/lttng-live-functions.c index 34612cf7..2d923618 100644 --- a/formats/lttng-live/lttng-live-functions.c +++ b/formats/lttng-live/lttng-live-functions.c @@ -110,6 +110,7 @@ int lttng_live_establish_connection(struct lttng_live_ctx *ctx) cmd.data_size = sizeof(connect); cmd.cmd_version = 0; + connect.viewer_session_id = -1ULL; /* will be set on recv */ connect.major = htobe32(LTTNG_LIVE_MAJOR); connect.minor = htobe32(LTTNG_LIVE_MINOR); connect.type = htobe32(LTTNG_VIEWER_CLIENT_COMMAND); @@ -201,6 +202,8 @@ int lttng_live_list_sessions(struct lttng_live_ctx *ctx, const char *path) goto error; } assert(ret_len == sizeof(lsession)); + lsession.hostname[LTTNG_VIEWER_HOST_NAME_MAX - 1] = '\0'; + lsession.session_name[LTTNG_VIEWER_NAME_MAX - 1] = '\0'; fprintf(stdout, "%s/%" PRIu64 " : %s on host %s (timer = %u, " "%u stream(s), %u client(s) connected)\n", @@ -355,6 +358,8 @@ int lttng_live_attach_session(struct lttng_live_ctx *ctx, uint64_t id) goto error; } assert(ret_len == sizeof(stream)); + stream.path_name[LTTNG_VIEWER_PATH_MAX - 1] = '\0'; + stream.channel_name[LTTNG_VIEWER_NAME_MAX - 1] = '\0'; printf_verbose(" stream %" PRIu64 " : %s/%s\n", be64toh(stream.id), stream.path_name, @@ -371,7 +376,6 @@ int lttng_live_attach_session(struct lttng_live_ctx *ctx, uint64_t id) path = strdup(LTTNG_METADATA_PATH_TEMPLATE); path = mkdtemp(path); ctx->session->streams[i].metadata_flag = 1; - mkdir(path, S_IRWXU | S_IRWXG); snprintf(ctx->session->streams[i].path, sizeof(ctx->session->streams[i].path), "%s/%s", path, @@ -380,6 +384,7 @@ int lttng_live_attach_session(struct lttng_live_ctx *ctx, uint64_t id) O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); if (ret < 0) { + perror("open"); goto error; } ctx->session->streams[i].fd = ret;