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.
This commit is contained in:
Miroslav Zagorac 2022-03-01 18:42:54 +01:00 committed by Willy Tarreau
parent 8c7927c6dd
commit 728627f932

View File

@ -306,7 +306,13 @@ int flt_ot_var_set(struct stream *s, const char *scope, const char *prefix, cons
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);
}