summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6cb6987)
raw | patch | inline | side by side (parent: 6cb6987)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 29 Jun 2011 15:18:22 +0000 (15:18 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 29 Jun 2011 15:18:22 +0000 (15:18 +0000) |
src/rrd_format.c | patch | blob | history | |
src/rrd_resize.c | patch | blob | history |
diff --git a/src/rrd_format.c b/src/rrd_format.c
index 501b2676d95b6661966b85eadc9ba2b849285f99..5200b33703a4e065068997af0318b1dc015e1b54 100644 (file)
--- a/src/rrd_format.c
+++ b/src/rrd_format.c
return sizeof(stat_head_t) + \
sizeof(ds_def_t) * rrd->stat_head->ds_cnt + \
sizeof(rra_def_t) * rrd->stat_head->rra_cnt + \
- sizeof(time_t) + \
- sizeof(live_head_t) + \
+ ( atoi(rrd->stat_head->version) < 3 ? sizeof(time_t) : sizeof(live_head_t) ) + \
sizeof(pdp_prep_t) * rrd->stat_head->ds_cnt + \
sizeof(cdp_prep_t) * rrd->stat_head->ds_cnt * rrd->stat_head->rra_cnt + \
sizeof(rra_ptr_t) * rrd->stat_head->rra_cnt;
diff --git a/src/rrd_resize.c b/src/rrd_resize.c
index 81410251d0071583db8a5f24cd12c24fa68a42de..3613d3f2b8db8fb4e889563ea488b878a5e224b5 100644 (file)
--- a/src/rrd_resize.c
+++ b/src/rrd_resize.c
/* Move the rest of the CDPs
*/
while (1) {
- if (rrd_read(rrd_file, &buffer, sizeof(rrd_value_t) * 1) <= 0)
+ ssize_t b_read;
+ if ((b_read=rrd_read(rrd_file, &buffer, sizeof(rrd_value_t) * 1)) <= 0)
break;
- rrd_write(rrd_out_file, &buffer, sizeof(rrd_value_t) * 1);
+ if(rrd_out_file->pos+b_read > rrd_out_file->file_len) {
+ fprintf(stderr,"WARNING: ignoring last %zu bytes\nWARNING: if you see this message multiple times for a single file you're in trouble\n", b_read);
+ continue;
+ }
+ rrd_write(rrd_out_file, &buffer, b_read);
}
rrdnew.rra_def[target_rra].row_cnt += modify;
rrd_seek(rrd_out_file,