prepare for the release of rrdtool-1.2.12
[rrdtool.git] / src / rrd_restore.c
index 345b77e..cd3d1ed 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.2.4  Copyright by Tobi Oetiker, 1997-2005
+ * RRDtool 1.2.12  Copyright by Tobi Oetiker, 1997-2005
  *****************************************************************************
  * rrd_restore.c  creates new rrd from data dumped by rrd_dump.c
  *****************************************************************************/
@@ -8,7 +8,7 @@
 #include "rrd_rpncalc.h"
 #include <fcntl.h>
 
-#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
 #include <io.h>
 #define open _open
 #define close _close
@@ -132,13 +132,11 @@ int xml2rrd(char* buf, rrd_t* rrd, char rc){
   {
     rrd_set_error("Incompatible file version, detected version %s is bigger than supported version %s\n",
                  rrd -> stat_head -> version, RRD_VERSION );
-    free(rrd -> stat_head);
     return -1;
   }
   if (atoi(rrd -> stat_head -> version) < 2) 
   {
-    rrd_set_error("Can only restore version >= 2 (Not %s). Dump your rrd using a current rrdtool dump.",  rrd -> stat_head -> version );
-    free(rrd -> stat_head);
+    rrd_set_error("Can only restore version >= 2 (Not %s). Dump your old rrd using a current rrdtool dump.",  rrd -> stat_head -> version );
     return -1;
   }
   rrd->stat_head->float_cookie = FLOAT_COOKIE;
@@ -421,7 +419,7 @@ rrd_write(char *file_name, rrd_t *rrd, char force_overwrite)
     if (strcmp("-",file_name)==0){
       rrd_file= stdout;
     } else {
-#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
       fdflags = O_RDWR|O_BINARY|O_CREAT;
 #else
       fdflags = O_WRONLY|O_CREAT;
@@ -506,7 +504,7 @@ rrd_restore(int argc, char **argv)
                int opt;
                
                
-               opt = getopt_long(argc, argv, "r:f", long_options, &option_index);
+               opt = getopt_long(argc, argv, "rf", long_options, &option_index);
                
                if (opt == EOF)
                        break;