From ca86420e6801c5e97cc40176cce27d2b0125a430 Mon Sep 17 00:00:00 2001 From: Francois-Xavier Bourlet Date: Sun, 21 Aug 2011 11:05:40 +0200 Subject: [PATCH] fix xff excessive rounding Hi, When generating arguments for rrd_create, the previous format string "%.1f", was rounding up the value too aggressively. ex: for xff==0.9999 the result would be -> 1.0 (invalid value for xff!) The new format string is "%.10f", which lead up to 10 digits after the dot, enough to be close to the double type limit, and so handling correctly the previous example. Change-Id: I7c6cc55b0d43beb5ef351bb04b67f4628249c737 --- src/utils_rrdcreate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils_rrdcreate.c b/src/utils_rrdcreate.c index 66bb27e7..47bf9f66 100644 --- a/src/utils_rrdcreate.c +++ b/src/utils_rrdcreate.c @@ -153,7 +153,7 @@ static int rra_get (char ***ret, const value_list_t *vl, /* {{{ */ if (rra_num >= rra_max) break; - status = ssnprintf (buffer, sizeof (buffer), "RRA:%s:%3.1f:%u:%u", + status = ssnprintf (buffer, sizeof (buffer), "RRA:%s:%.10f:%u:%u", rra_types[j], cfg->xff, cdp_len, cdp_num); if ((status < 0) || ((size_t) status >= sizeof (buffer))) -- 2.11.0