]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Support version 4 RRD files
authorPeter Stamfest <peter@stamfest.at>
Sun, 2 Mar 2014 23:05:06 +0000 (00:05 +0100)
committerPeter Stamfest <peter@stamfest.at>
Mon, 3 Mar 2014 07:26:19 +0000 (08:26 +0100)
src/rrd_modify.c

index f421e8966fe56bd5a6397e22e45d9b9a1f990d35..d2d11f97c4bd03dd64efb85c5b7041be5ad8f51e 100644 (file)
@@ -377,8 +377,8 @@ static int rrd_modify_r(const char *infilename,
        files should be modified, a dump/restore cycle should be
        done.... */
 
-    if (strcmp(in.stat_head->version, "0003") != 0) {
-       rrd_set_error("direct modification is only supported for version 3 RRD files. Consider to dump/restore before retrying a modification");
+    if (! (strcmp(in.stat_head->version, RRD_VERSION3) == 0 || strcmp(in.stat_head->version, RRD_VERSION) == 0) ) {
+       rrd_set_error("direct modification is only supported for version 3 or version 4 RRD files. Consider to dump/restore before retrying a modification");
        goto done;
     }
 
@@ -393,7 +393,7 @@ static int rrd_modify_r(const char *infilename,
     memset(out.stat_head, 0, (sizeof(stat_head_t)));
 
     strncpy(out.stat_head->cookie, "RRD", sizeof(out.stat_head->cookie));
-    strcpy(out.stat_head->version, "0003");
+    strcpy(out.stat_head->version, in.stat_head->version);
     out.stat_head->float_cookie = FLOAT_COOKIE;
     out.stat_head->pdp_step = in.stat_head->pdp_step;