Skip to content

Commit

Permalink
Commented setlocal as it leads to crashes on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaderi committed Dec 20, 2018
1 parent 6e4f44b commit 962ecab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions third-party/rrdtool-1.4.8/src/rrd_create.c
Expand Up @@ -597,8 +597,8 @@ void parseGENERIC_DS(
&(rrd -> ds_def[ds_idx].par[DS_mrhb_cnt].u_cnt),
minstr,maxstr);
*/
old_locale = setlocale(LC_NUMERIC, NULL);
setlocale(LC_NUMERIC, "C");
// old_locale = setlocale(LC_NUMERIC, NULL);
// setlocale(LC_NUMERIC, "C");
if (sscanf(def, "%lu:%18[^:]:%18[^:]",
&(rrd->ds_def[ds_idx].par[DS_mrhb_cnt].u_cnt),
minstr, maxstr) == 3) {
Expand All @@ -617,13 +617,13 @@ void parseGENERIC_DS(
rrd->ds_def[ds_idx].par[DS_min_val].u_val
>= rrd->ds_def[ds_idx].par[DS_max_val].u_val) {
rrd_set_error("min must be less than max in DS definition");
setlocale(LC_NUMERIC, old_locale);
// setlocale(LC_NUMERIC, old_locale);
return;
}
} else {
rrd_set_error("failed to parse data source %s", def);
}
setlocale(LC_NUMERIC, old_locale);
// setlocale(LC_NUMERIC, old_locale);
}

/* Create the CF_DEVPREDICT, CF_DEVSEASONAL, CF_SEASONAL, and CF_FAILURES RRAs
Expand Down
18 changes: 9 additions & 9 deletions third-party/rrdtool-1.4.8/src/rrd_update.c
Expand Up @@ -970,16 +970,16 @@ 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, NULL);
setlocale(LC_NUMERIC, "C");
// old_locale = setlocale(LC_NUMERIC, NULL);
// setlocale(LC_NUMERIC, "C");
errno = 0;
tmp = strtod(updvals[0], 0);
if (errno > 0) {
rrd_set_error("converting '%s' to float: %s",
updvals[0], rrd_strerror(errno));
return -1;
};
setlocale(LC_NUMERIC, old_locale);
// setlocale(LC_NUMERIC, old_locale);
if (tmp < 0.0){
gettimeofday(&tmp_time, 0);
tmp = (double)tmp_time.tv_sec + (double)tmp_time.tv_usec * 1e-6f + tmp;
Expand Down Expand Up @@ -1083,16 +1083,16 @@ static int update_pdp_prep(
}
break;
case DST_ABSOLUTE:
old_locale = setlocale(LC_NUMERIC, NULL);
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) {
rrd_set_error("converting '%s' to float: %s",
updvals[ds_idx + 1], rrd_strerror(errno));
return -1;
};
setlocale(LC_NUMERIC, old_locale);
// setlocale(LC_NUMERIC, old_locale);
if (endptr[0] != '\0') {
rrd_set_error
("conversion of '%s' to float not complete: tail '%s'",
Expand All @@ -1102,8 +1102,8 @@ static int update_pdp_prep(
rate = pdp_new[ds_idx] / interval;
break;
case DST_GAUGE:
old_locale = setlocale(LC_NUMERIC, NULL);
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;
Expand All @@ -1112,7 +1112,7 @@ static int update_pdp_prep(
updvals[ds_idx + 1], rrd_strerror(errno));
return -1;
};
setlocale(LC_NUMERIC, old_locale);
// setlocale(LC_NUMERIC, old_locale);
if (endptr[0] != '\0') {
rrd_set_error
("conversion of '%s' to float not complete: tail '%s'",
Expand Down

0 comments on commit 962ecab

Please sign in to comment.