]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: opentracing: setting the return value in function flt_ot_var_set()
authorMiroslav Zagorac <mzagorac@haproxy.com>
Tue, 1 Mar 2022 17:42:54 +0000 (18:42 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 8 Apr 2022 14:31:33 +0000 (16:31 +0200)
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.

addons/ot/src/vars.c

index dd823b1a71f564f9b4e513753e8ef317d0bea5a4..33923938a4d2d44cb7c8ac289c94e6c902a897db 100644 (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);
 }