BUG/MINOR: opentracing: setting the return value in function flt_ot_var_set()
Function flt_ot_var_set() did not check whether the variable was
successfully set or not. In case of failure, the value -1 is returned.
This patch must be backported as far as 2.4.
(cherry picked from commit 728627f932fcc9e07df7d2af3e0df9f50102203a)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit cdb27fd2c02ccfad48634c7f17f5d169a6ebac78)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/addons/ot/src/vars.c b/addons/ot/src/vars.c
index fff54ac..06696b7 100644
--- a/addons/ot/src/vars.c
+++ b/addons/ot/src/vars.c
@@ -306,7 +306,13 @@
smp.data.u.str.area = (char *)value;
smp.data.u.str.data = strlen(value);
- vars_set_by_name_ifexist(var_name, retval, &smp);
+ if (vars_set_by_name_ifexist(var_name, retval, &smp) == 0) {
+ FLT_OT_ERR("failed to set variable '%s'", var_name);
+
+ retval = -1;
+ } else {
+ FLT_OT_DBG(2, "variable '%s' set", var_name);
+ }
FLT_OT_RETURN(retval);
}