From f312b3aa35382b62e9f8bd2c4cbdd9180490845e Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 25 Feb 2014 10:48:13 -0500 Subject: [PATCH] Fix: handle new streams in get_data_packet() - don't skip ask_new_streams() if new metadata _and_ new streams are available. - goto retry after getting new streams. - Add missing "ret = 0" assignment at the end of the function. Takes care of "possible use of uninitialized variables" warnings in the caller given by gcc. Signed-off-by: Mathieu Desnoyers --- formats/lttng-live/lttng-live-comm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/formats/lttng-live/lttng-live-comm.c b/formats/lttng-live/lttng-live-comm.c index 76dc6bbb..945df431 100644 --- a/formats/lttng-live/lttng-live-comm.c +++ b/formats/lttng-live/lttng-live-comm.c @@ -676,15 +676,19 @@ retry: ret = append_metadata(ctx, stream); if (ret) goto error; - goto retry; } if (rp.flags & LTTNG_VIEWER_FLAG_NEW_STREAM) { + printf_verbose("get_data_packet: new streams needed\n"); ret = ask_new_streams(ctx); if (ret < 0) goto error; g_hash_table_foreach(ctx->session->ctf_traces, add_traces, ctx->bt_ctx); } + if (rp.flags & (LTTNG_VIEWER_FLAG_NEW_METADATA + | LTTNG_VIEWER_FLAG_NEW_STREAM)) { + goto retry; + } fprintf(stderr, "[error] get_data_packet: error\n"); ret = -1; goto end; @@ -745,7 +749,7 @@ retry: goto error; } assert(ret_len == len); - + ret = 0; end: error: return ret; -- 2.34.1