X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Frrd_restore.c;h=f3764dac6ce21042dc38d55778586cbf09198f9d;hb=3919b6d8c40073f47fc37424d0c022752ce85f29;hp=150f1ee8fd5f53a578d683297386160e1d6e1f40;hpb=801ce418130e78b4b6818f2c8af85c3ddae400ff;p=rrdtool.git diff --git a/src/rrd_restore.c b/src/rrd_restore.c index 150f1ee..f3764da 100644 --- a/src/rrd_restore.c +++ b/src/rrd_restore.c @@ -122,10 +122,16 @@ int xml2rrd(char* buf, rrd_t* rrd, char rc){ strcpy(rrd->stat_head->cookie,RRD_COOKIE); read_tag(&ptr,"version","%4[0-9]",rrd->stat_head->version); /* added primitive version checking */ - if (atoi(rrd -> stat_head -> version) != 2) + if (atoi(rrd -> stat_head -> version) > atoi(RRD_VERSION) ) { - rrd_set_error("Incompatible file version, detected version %s, required version %s\n", - rrd -> stat_head -> version, RRD_VERSION); + 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); return -1; }