[lttng-dev] [PATCH babeltrace] Fix: memstream compat layer requires use of babeltrace_close_memstream

Michael Jeanson mjeanson at efficios.com
Thu Oct 15 12:08:48 EDT 2015


From: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>

In compatibility mode, the babeltrace compat layer around memstream
copies the file content into the buffer only at close.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 formats/lttng-live/lttng-live-comm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/formats/lttng-live/lttng-live-comm.c b/formats/lttng-live/lttng-live-comm.c
index 91e344c..6422e65 100644
--- a/formats/lttng-live/lttng-live-comm.c
+++ b/formats/lttng-live/lttng-live-comm.c
@@ -932,8 +932,9 @@ int get_new_metadata(struct lttng_live_ctx *ctx,
 		}
 	} while (ret > 0 || !len_read);
 
-	if (fclose(metadata_stream->metadata_fp_write))
-		perror("fclose");
+	if (babeltrace_close_memstream(metadata_buf, &size,
+			metadata_stream->metadata_fp_write))
+		perror("babeltrace_close_memstream");
 	metadata_stream->metadata_fp_write = NULL;
 
 error:
-- 
1.9.1




More information about the lttng-dev mailing list