diff --git a/src/rrd_resize.c b/src/rrd_resize.c
index 52c208b58f6c98869bafee934ba059b94f1cac12..55ced9ec5c35f0c9f51f613872daca4294d5fe4d 100644 (file)
--- a/src/rrd_resize.c
+++ b/src/rrd_resize.c
return (-1);
}
- if (modify < 0)
+ if (modify < 0) {
if ((long) rrdold.rra_def[target_rra].row_cnt <= -modify) {
rrd_set_error("This RRA is not that big");
rrd_free(&rrdold);
rrd_close(rrd_file);
return (-1);
}
-
+ } else {
+ /* the size of the new file */
+ rrdnew.stat_head = rrd_file->file_len +
+ (rrdold.stat_head->ds_cnt * sizeof(rrd_value_t) * modify);
+ }
rrd_out_file = rrd_open(outfilename, &rrdnew, RRD_READWRITE | RRD_CREAT);
if (rrd_out_file == NULL) {
rrd_set_error("Can't create '%s': %s", outfilename,