Fix: ctf: set `ret` on error paths
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 5 May 2021 14:19:19 +0000 (10:19 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 10 Sep 2021 14:39:08 +0000 (10:39 -0400)
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 <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/5691
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/plugins/ctf/common/metadata/visitor-generate-ir.c

index 810f3ed1fa86ab022d495531aec059f361a81e4a..a7ea0f0978f87cae6316560a3b026a8f936c88a0 100644 (file)
@@ -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;
                        }
 
This page took 0.026814 seconds and 4 git commands to generate.