summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 58570a1)
raw | patch | inline | side by side (parent: 58570a1)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 4 May 2006 13:12:01 +0000 (13:12 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Thu, 4 May 2006 13:12:01 +0000 (13:12 +0000) |
program/src/rrd_create.c | patch | blob | history | |
program/src/rrd_open.c | patch | blob | history | |
program/src/rrd_restore.c | patch | blob | history |
index 78979f5c88e820dd67c706a4765b9a1890100cb7..0fd96cbd575164d133ae4727b38dfbcd67b5c0e5 100644 (file)
--- a/program/src/rrd_create.c
+++ b/program/src/rrd_create.c
if ((rrd_file = fopen(file_name,"wb")) == NULL ) {
rrd_set_error("creating '%s': %s",file_name, rrd_strerror(errno));
free(rrd->stat_head);
+ rrd->stat_head = NULL;
free(rrd->ds_def);
+ rrd->ds_def = NULL;
free(rrd->rra_def);
+ rrd->rra_def = NULL;
return(-1);
}
diff --git a/program/src/rrd_open.c b/program/src/rrd_open.c
index 23914826fc4ff59fab4614f4199503f3f1f04967..567ffdb8cde9a6c765c0f863a7faf99647f67ea3 100644 (file)
--- a/program/src/rrd_open.c
+++ b/program/src/rrd_open.c
if (strncmp(rrd->stat_head->cookie,RRD_COOKIE,4) != 0){
rrd_set_error("'%s' is not an RRD file",file_name);
free(rrd->stat_head);
+ rrd->stat_head = NULL;
fclose(*in_file);
return(-1);}
if (rrd->stat_head->float_cookie != FLOAT_COOKIE){
rrd_set_error("This RRD was created on other architecture");
free(rrd->stat_head);
+ rrd->stat_head = NULL;
fclose(*in_file);
return(-1);}
rrd_set_error("can't handle RRD file version %s",
rrd->stat_head->version);
free(rrd->stat_head);
+ rrd->stat_head = NULL;
fclose(*in_file);
return(-1);}
index 3246047ce8677fd1d9ea7f2ad098e4c611911003..a7945239609fcba96995af93577a245a8fdf1200 100644 (file)
read_tag(&ptr,"version","%4[0-9]",rrd->stat_head->version);
input_version = atoi(rrd->stat_head->version);
/* added primitive version checking */
- if (input_version > atoi(RRD_VERSION) )
+ if (input_version > atoi(RRD_VERSION) || input_version < 1)
{
- rrd_set_error("Incompatible file version, detected version %s is bigger than supported version %s\n",
+ rrd_set_error("Incompatible file version, detected version %s. This is not supported by the version %s restore tool.\n",
rrd -> stat_head -> version, RRD_VERSION );
+ free(rrd -> stat_head);
+ rrd->stat_head = NULL;
return -1;
}
/* make sure we output the right version */