summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 28a2150)
raw | patch | inline | side by side (parent: 28a2150)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 8 Sep 2010 12:15:13 +0000 (12:15 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 8 Sep 2010 12:15:13 +0000 (12:15 +0000) |
- old_locale = setlocale(LC_NUMERIC, "C");
+ old_locale = setlocale(LC_NUMERIC, NULL);
+ setlocale(LC_NUMERIC, "C");
the original version never restored the locale since it held a copy of the
new locale and not the old one despite the name. bug found by Pawe? 'Reef' Polewicz
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@2127 a5681a0c-68f1-0310-ab6d-d61299d08faa
+ old_locale = setlocale(LC_NUMERIC, NULL);
+ setlocale(LC_NUMERIC, "C");
the original version never restored the locale since it held a copy of the
new locale and not the old one despite the name. bug found by Pawe? 'Reef' Polewicz
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@2127 a5681a0c-68f1-0310-ab6d-d61299d08faa
src/rrd_create.c | patch | blob | history | |
src/rrd_dump.c | patch | blob | history | |
src/rrd_graph.c | patch | blob | history | |
src/rrd_rpncalc.c | patch | blob | history | |
src/rrd_tool.c | patch | blob | history | |
src/rrd_tune.c | patch | blob | history | |
src/rrd_update.c | patch | blob | history |
diff --git a/src/rrd_create.c b/src/rrd_create.c
index 2a0a143c9281c2e5e7edfa08a8be2a5acb8f0132..c8996ce82f81f61177774fd918523ef2c903f4f7 100644 (file)
--- a/src/rrd_create.c
+++ b/src/rrd_create.c
&(rrd -> ds_def[ds_idx].par[DS_mrhb_cnt].u_cnt),
minstr,maxstr);
*/
- old_locale = 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) {
diff --git a/src/rrd_dump.c b/src/rrd_dump.c
index ccc5349f1c5092e097d4ab8dfd3abb0cb471c6e6..bdd8a526460489d13329c3b0b14aa341357eb1d4 100644 (file)
--- a/src/rrd_dump.c
+++ b/src/rrd_dump.c
return (-1);
}
- old_locale = setlocale(LC_NUMERIC, "C");
+ old_locale = setlocale(LC_NUMERIC, NULL);
+ setlocale(LC_NUMERIC, "C");
if (opt_header == 1) {
diff --git a/src/rrd_graph.c b/src/rrd_graph.c
index d15ce3d20725ef14e5761851b630f5ad6e6a41c7..898b6ff9c8e7dce2eecb3a2359e4615ba135d7b2 100644 (file)
--- a/src/rrd_graph.c
+++ b/src/rrd_graph.c
char *old_locale;
rrd_graph_init(&im);
/* a dummy surface so that we can measure text sizes for placements */
- old_locale = setlocale(LC_NUMERIC, "C");
+ old_locale = setlocale(LC_NUMERIC, NULL);
+ setlocale(LC_NUMERIC, "C");
rrd_graph_options(argc, argv, &im);
if (rrd_test_error()) {
+ setlocale(LC_NUMERIC, old_locale); /* reenable locale */
rrd_info_free(im.grinfo);
im_free(&im);
return NULL;
}
if (optind >= argc) {
+ setlocale(LC_NUMERIC, old_locale); /* reenable locale */
rrd_info_free(im.grinfo);
im_free(&im);
rrd_set_error("missing filename");
}
if (strlen(argv[optind]) >= MAXPATH) {
+ setlocale(LC_NUMERIC, old_locale); /* reenable locale */
rrd_set_error("filename (including path) too long");
rrd_info_free(im.grinfo);
im_free(&im);
diff --git a/src/rrd_rpncalc.c b/src/rrd_rpncalc.c
index 80eb14450eb432c496dd588b9860b22ee8573d7f..c1a61c205adb8cb5693654df19eacb368e1a4770 100644 (file)
--- a/src/rrd_rpncalc.c
+++ b/src/rrd_rpncalc.c
char vname[MAX_VNAME_LEN + 10];
char *old_locale;
- old_locale = setlocale(LC_NUMERIC, "C");
+ old_locale = setlocale(LC_NUMERIC, NULL);
+ setlocale(LC_NUMERIC, "C");
rpnp = NULL;
expr = (char *) expr_const;
diff --git a/src/rrd_tool.c b/src/rrd_tool.c
index 45296c8006f10fcdc93b7b46146fdfe19c6fd054..cc2aede9e7b2207063f53e2324c5ae542b16e01b 100644 (file)
--- a/src/rrd_tool.c
+++ b/src/rrd_tool.c
if (rrd_xport
(argc - 1, &argv[1], &xxsize, &start, &end, &step, &col_cnt,
&legend_v, &data) != -1) {
- char *old_locale = setlocale(LC_NUMERIC, "C");
+ char *old_locale = setlocale(LC_NUMERIC,NULL);
+ setlocale(LC_NUMERIC, "C");
row_cnt = (end - start) / step;
ptr = data;
printf("<?xml version=\"1.0\" encoding=\"%s\"?>\n\n",
diff --git a/src/rrd_tune.c b/src/rrd_tune.c
index 80c2de0b0ef8abd6ae48ffe8b6f4169840fae459..52651fdfe4cd3886a301dd27708049fc7ee347ff 100644 (file)
--- a/src/rrd_tune.c
+++ b/src/rrd_tune.c
optcnt++;
switch (opt) {
case 'h':
- old_locale = setlocale(LC_NUMERIC, "C");
+ old_locale = setlocale(LC_NUMERIC, NULL);
+ setlocale(LC_NUMERIC, "C");
if ((matches =
sscanf(optarg, DS_NAM_FMT ":%ld", ds_nam,
&heartbeat)) != 2) {
break;
case 'i':
- old_locale = setlocale(LC_NUMERIC, "C");
+ old_locale = setlocale(LC_NUMERIC, NULL);
+ setlocale(LC_NUMERIC, "C");
if ((matches =
sscanf(optarg, DS_NAM_FMT ":%lf", ds_nam, &min)) < 1) {
rrd_set_error("invalid arguments for minimum ds value");
break;
case 'a':
- old_locale = setlocale(LC_NUMERIC, "C");
+ old_locale = setlocale(LC_NUMERIC, NULL);
+ setlocale(LC_NUMERIC, "C");
if ((matches =
sscanf(optarg, DS_NAM_FMT ":%lf", ds_nam, &max)) < 1) {
rrd_set_error("invalid arguments for maximum ds value");
diff --git a/src/rrd_update.c b/src/rrd_update.c
index a06b404e9d3ef26c545959bd469b8652e22834bb..563d7ac81fbf7fe177801869f3969b6e97284f65 100644 (file)
--- a/src/rrd_update.c
+++ b/src/rrd_update.c
*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) {
}
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) {
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;