From d6701381e38348beced306a0ad9947fb3fb8ad82 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 5 May 2021 10:19:19 -0400 Subject: [PATCH] Fix: ctf: set `ret` on error paths The error paths touched by this patch currently don't set the `ret` variable, resulting in the error not being communicated to the caller. Fix that. Change-Id: If044e4ff28a98bda408610c1c2f85d7fe13ea1c1 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/5691 Tested-by: jenkins Reviewed-by: Philippe Proulx --- src/plugins/ctf/common/metadata/visitor-generate-ir.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/ctf/common/metadata/visitor-generate-ir.c b/src/plugins/ctf/common/metadata/visitor-generate-ir.c index 810f3ed1..a7ea0f09 100644 --- a/src/plugins/ctf/common/metadata/visitor-generate-ir.c +++ b/src/plugins/ctf/common/metadata/visitor-generate-ir.c @@ -3721,6 +3721,7 @@ int visit_stream_decl(struct ctx *ctx, struct ctf_node *node) _BT_COMP_LOGE_NODE(node, "Stream class has a `id` attribute, " "but trace has no packet header field class."); + ret = -EINVAL; goto error; } @@ -3730,6 +3731,7 @@ int visit_stream_decl(struct ctx *ctx, struct ctf_node *node) _BT_COMP_LOGE_NODE(node, "Stream class has a `id` attribute, " "but trace's packet header field class has no `stream_id` field."); + ret = -EINVAL; goto error; } @@ -3738,6 +3740,7 @@ int visit_stream_decl(struct ctx *ctx, struct ctf_node *node) _BT_COMP_LOGE_NODE(node, "Stream class has a `id` attribute, " "but trace's packet header field class's `stream_id` field is not an integer field class."); + ret = -EINVAL; goto error; } } else { @@ -3832,6 +3835,7 @@ int visit_trace_decl_entry(struct ctx *ctx, struct ctf_node *node, int *set) if (val != 1) { _BT_COMP_LOGE_NODE(node, "Invalid trace's `minor` attribute: expecting 1."); + ret = -EINVAL; goto error; } @@ -3856,6 +3860,7 @@ int visit_trace_decl_entry(struct ctx *ctx, struct ctf_node *node, int *set) if (val != 8) { _BT_COMP_LOGE_NODE(node, "Invalid trace's `minor` attribute: expecting 8."); + ret = -EINVAL; goto error; } -- 2.34.1