summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f8c0581)
raw | patch | inline | side by side (parent: f8c0581)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 22 Nov 2011 15:40:22 +0000 (15:40 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Tue, 22 Nov 2011 15:40:22 +0000 (15:40 +0000) |
that does not occure in the wild, as rrdtool prevents the creation of such
rrd files. But rrdtool restore 1.3 did allows to create them via restore.
Now this is possible again. Fix for #310.
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.4/program@2212 a5681a0c-68f1-0310-ab6d-d61299d08faa
rrd files. But rrdtool restore 1.3 did allows to create them via restore.
Now this is possible again. Fix for #310.
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.4/program@2212 a5681a0c-68f1-0310-ab6d-d61299d08faa
src/rrd_restore.c | patch | blob | history |
diff --git a/src/rrd_restore.c b/src/rrd_restore.c
index 61df4f746cdc37a8ac5b6fb8f23ec74e13714b32..77c8302d0cc79ee1c57230892180bb2b5b4c90b5 100644 (file)
--- a/src/rrd_restore.c
+++ b/src/rrd_restore.c
/* All space successfully allocated, increment number of RRAs. */
rrd->stat_head->rra_cnt++;
-
+
status = 0;
while ((element = get_xml_element(reader)) != NULL){
if (xmlStrcasecmp(element, (const xmlChar *) "cf") == 0)
return status;
}
else if (xmlStrcasecmp(element,(const xmlChar *) "/rra") == 0){
- xmlFree(element);
+ xmlFree(element);
return status;
} /* }}} */
else {
unsigned long num_rows = rrd->rra_def[i].row_cnt;
unsigned long cur_row = rrd->rra_ptr[i].cur_row;
unsigned long ds_cnt = rrd->stat_head->ds_cnt;
+ if (num_rows > 0){
+ fwrite(rrd->rrd_value +
+ (rra_offset + num_rows - 1 - cur_row) * ds_cnt,
+ sizeof(rrd_value_t), (cur_row + 1) * ds_cnt, fh);
- fwrite(rrd->rrd_value +
- (rra_offset + num_rows - 1 - cur_row) * ds_cnt,
- sizeof(rrd_value_t), (cur_row + 1) * ds_cnt, fh);
-
- fwrite(rrd->rrd_value + rra_offset * ds_cnt,
- sizeof(rrd_value_t), (num_rows - 1 - cur_row) * ds_cnt, fh);
+ fwrite(rrd->rrd_value + rra_offset * ds_cnt,
+ sizeof(rrd_value_t), (num_rows - 1 - cur_row) * ds_cnt, fh);
- rra_offset += num_rows;
+ rra_offset += num_rows;
+ }
}
/* lets see if we had an error */