summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 68d434a)
raw | patch | inline | side by side (parent: 68d434a)
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/branches/1.3/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/branches/1.3/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 4e98d53c40be069539ee45c19334f271362f631b..d9fd6fffa9652149f25a84dab892e8e36ae7af5f 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 226f5ecd19c9a035ddf2e6c36fabea24d6bedbdb..de037b87f6d2e8e2dfc98e471184942a4d0247f6 100644 (file)
--- a/src/rrd_dump.c
+++ b/src/rrd_dump.c
out_file = stdout;
}
#ifdef HAVE_SETLOCALE
- old_locale = setlocale(LC_NUMERIC, "C");
+ old_locale = setlocale(LC_NUMERIC, NULL);
+ setlocale(LC_NUMERIC, "C");
#endif
if (!opt_noheader) {
fputs("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n", out_file);
diff --git a/src/rrd_graph.c b/src/rrd_graph.c
index 022ca27d8521cded9f12fe21a3e702fcb687afb4..dcc20241120b7bf70875e853bc04740869d68451 100644 (file)
--- a/src/rrd_graph.c
+++ b/src/rrd_graph.c
rrd_info_t *grinfo;
rrd_graph_init(&im);
/* a dummy surface so that we can measure text sizes for placements */
+ 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);
}
rrd_graph_script(argc, argv, &im, 1);
+ setlocale(LC_NUMERIC, old_locale); /* reenable locale */
if (rrd_test_error()) {
rrd_info_free(im.grinfo);
im_free(&im);
diff --git a/src/rrd_rpncalc.c b/src/rrd_rpncalc.c
index d46de8067017ae22152175174166511775899a2b..e4b224de0a7b4fd342a7f107bf77a7dc65acc969 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 454907386cb0c66a468aa49dbf7a83a044ef76bf..8fe46a2c48a8cc25282ca2977904031bd0199c35 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 55aff3d5d35ff465dbc9a6274475618f89b1e5fc..1d783801e26c652b2bf4500751fc24175dc2cc01 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 200f412071b42e75688b40b13139df15d5213d75..6e15b080af8895f494c2e3d8e249ec31b3885dcf 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;