From: Florian Forster Date: Tue, 9 Sep 2014 21:43:11 +0000 (+0200) Subject: src/configfile.c: Fix the default interval setting. X-Git-Tag: collectd-5.5.0~201 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=3281172053c295f958c5e2fa6e8a4ffa3b8d0565;p=collectd.git 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 --- 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)