fix memory handling when argument separation in pipe mode fails. fix for #230
[rrdtool.git] / src / rrd_restore.c
index 46a79b5..cc9b9c6 100644 (file)
@@ -2,7 +2,9 @@
  * RRDtool 1.3.2  Copyright by Tobi Oetiker, 1997-2009                    
  *****************************************************************************
  * rrd_restore.c  Contains logic to parse XML input and create an RRD file
- *                initial libxml2 version of rrd_restore (c) by Florian octo Forster
+ * This file:
+ * Copyright (C) 2008  Florian octo Forster  (original libxml2 code)
+ * Copyright (C) 2008,2009 Tobias Oetiker
  *****************************************************************************
  * $Id$
  *************************************************************************** */
@@ -1212,7 +1214,7 @@ int rrd_restore(
     char **argv)
 {
     rrd_t    *rrd;
-
+    char     *old_locale;
     /* init rrd clean */
     optind = 0;
     opterr = 0;         /* initialize getopt */
@@ -1254,7 +1256,16 @@ int rrd_restore(
         return (-1);
     }
 
+#ifdef HAVE_SETLOCALE
+    old_locale = setlocale(LC_NUMERIC, "C");
+#endif
+
     rrd = parse_file(argv[optind]);
+
+#ifdef HAVE_SETLOCALE
+    setlocale(LC_NUMERIC, old_locale);
+#endif
+
     if (rrd == NULL)
         return (-1);