From 3281172053c295f958c5e2fa6e8a4ffa3b8d0565 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Tue, 9 Sep 2014 23:43:11 +0200 Subject: [PATCH] src/configfile.c: Fix the default interval setting. Also fixes a bug in global_option_get_time(): Values smaller than or equal to zero are illegal and the default value should be returned. Thanks to @anandkarthik for spotting this! Fixes: #727 --- src/configfile.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/configfile.c b/src/configfile.c index 9841efda..fbb3cd33 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -964,7 +964,7 @@ cdtime_t global_option_get_time (const char *name, cdtime_t def) /* {{{ */ v = strtod (optstr, &endptr); if ((endptr == NULL) || (*endptr != 0) || (errno != 0)) return (def); - else if (v >= 0.0) + else if (v <= 0.0) return (def); return (DOUBLE_TO_CDTIME_T (v)); @@ -972,7 +972,8 @@ cdtime_t global_option_get_time (const char *name, cdtime_t def) /* {{{ */ cdtime_t cf_get_default_interval (void) { - return (global_option_get_time ("Interval", COLLECTD_DEFAULT_INTERVAL)); + return (global_option_get_time ("Interval", + DOUBLE_TO_CDTIME_T (COLLECTD_DEFAULT_INTERVAL))); } void cf_unregister (const char *type) -- 2.30.2