[collectd] [PATCH] Fix conceptual buglet in default_callback

Florian Forster octo at collectd.org
Thu Aug 11 10:06:03 CEST 2016


Thanks David, committed to collectd-5.5 as a7b0cdea4f6a0f8d29ade21ae058182f720dd432.

Best regards,
—octo

On Wed, Aug 10, 2016 at 08:07:14PM +1000, David Gibson wrote:
> The 'DERIVE' path in default_callback() increments the 'counter' field of
> value instead of the 'derive' field.  Since those fields have the same
> type and offset within the value union this will still work fine, but
> AFAICT it's conceptually incorrect.  This corrects it.
> 
> Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
> ---
>  src/daemon/utils_match.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Came across this while looking at some other things.
> 
> diff --git a/src/daemon/utils_match.c b/src/daemon/utils_match.c
> index 5273c90..914b6e2 100644
> --- a/src/daemon/utils_match.c
> +++ b/src/daemon/utils_match.c
> @@ -170,7 +170,7 @@ static int default_callback (const char __attribute__((unused)) *str,
>  
>      if (data->ds_type & UTILS_MATCH_CF_DERIVE_INC)
>      {
> -      data->value.counter++;
> +      data->value.derive++;
>        data->values_num++;
>        return (0);
>      }
> -- 
> 2.7.4
> 
> 
> _______________________________________________
> collectd mailing list
> collectd at verplant.org
> https://mailman.verplant.org/listinfo/collectd

-- 
collectd – The system statistics collection daemon
Website: http://collectd.org
Google+: http://collectd.org/+
GitHub:  https://github.com/collectd
Twitter: http://twitter.com/collectd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20160811/ebbf3898/attachment.sig>


More information about the collectd mailing list