X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_update.c;h=c5917c0b93158fb93cb6963b19b1069128685cd9;hb=2f28002d6613be5c03edb76958b6aa6b300c8a80;hp=e4252db2ef829399d16dffe3f4f416d7472bb47c;hpb=4544c97f2699490bdfef560e6dbcd71de09db7b2;p=rrdtool.git diff --git a/src/rrd_update.c b/src/rrd_update.c index e4252db..c5917c0 100644 --- a/src/rrd_update.c +++ b/src/rrd_update.c @@ -352,14 +352,14 @@ rrd_info_t *rrd_update_v( } opt_daemon = getenv (ENV_RRDCACHED_ADDRESS); - if (opt_daemon != NULL) { + if (opt_daemon != NULL && ! strcmp(opt_daemon,"")) { rrd_set_error ("The \"%s\" environment variable is defined, " "but \"%s\" cannot work with rrdcached. Either unset " "the environment variable or use \"update\" instead.", ENV_RRDCACHED_ADDRESS, argv[0]); goto end_tag; } - + /* need at least 2 arguments: filename, data. */ if (argc - optind < 2) { rrd_set_error("Not enough arguments"); @@ -429,7 +429,10 @@ int rrd_update( { /* try to connect to rrdcached */ int status = rrdc_connect(opt_daemon); - if (status != 0) return status; + if (status != 0) { + rc = status; + goto out; + } } if ((tmplt != NULL) && rrdc_is_connected(opt_daemon)) @@ -977,7 +980,8 @@ static int get_time_from_reading( *current_time = tmp_time.tv_sec; *current_time_usec = tmp_time.tv_usec; } else { - old_locale = setlocale(LC_NUMERIC, "C"); + old_locale = setlocale(LC_NUMERIC, NULL); + setlocale(LC_NUMERIC, "C"); errno = 0; tmp = strtod(updvals[0], 0); if (errno > 0) { @@ -1089,7 +1093,8 @@ static int update_pdp_prep( } break; case DST_ABSOLUTE: - old_locale = setlocale(LC_NUMERIC, "C"); + old_locale = setlocale(LC_NUMERIC, NULL); + setlocale(LC_NUMERIC, "C"); errno = 0; pdp_new[ds_idx] = strtod(updvals[ds_idx + 1], &endptr); if (errno > 0) { @@ -1107,7 +1112,8 @@ static int update_pdp_prep( rate = pdp_new[ds_idx] / interval; break; case DST_GAUGE: - old_locale = setlocale(LC_NUMERIC, "C"); + old_locale = setlocale(LC_NUMERIC, NULL); + setlocale(LC_NUMERIC, "C"); errno = 0; pdp_new[ds_idx] = strtod(updvals[ds_idx + 1], &endptr) * interval; @@ -1558,7 +1564,7 @@ static int update_cdp_prep( if (elapsed_pdp_st > 2) { reset_cdp(rrd, elapsed_pdp_st, pdp_temp, last_seasonal_coef, seasonal_coef, rra_idx, ds_idx, cdp_idx, - (cf_en)current_cf); + (enum cf_en)current_cf); } }