From: oetiker Date: Tue, 6 Jan 2009 16:32:16 +0000 (+0000) Subject: with MMAP enabled rrd resize GROW was broken ... this fixes it ... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=eabc15340aa5f30367346d024b18c974242f4456;p=rrdtool-all.git with MMAP enabled rrd resize GROW was broken ... this fixes it ... git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.3@1726 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/program/src/rrd_resize.c b/program/src/rrd_resize.c index 322de046..edd415a4 100644 --- a/program/src/rrd_resize.c +++ b/program/src/rrd_resize.c @@ -102,10 +102,14 @@ int rrd_resize( rrd_set_error("Can't create '%s': %s", outfilename, rrd_strerror(errno)); rrd_free(&rrdnew); + rrd_free(&rrdold); + rrd_close(rrd_file); + rrd_close(rrd_out_file); return (-1); } if (rrd_lock(rrd_out_file) != 0) { rrd_set_error("could not lock new RRD"); + rrd_free(&rrdnew); rrd_free(&rrdold); rrd_close(rrd_file); rrd_close(rrd_out_file); @@ -203,7 +207,7 @@ int rrd_resize( case 3: break; case 1: - rrdold.stat_head->version[3] = '3'; + rrdnew.stat_head->version[3] = '3'; break; default: rrd_set_error("Do not know how to handle RRD version %s", @@ -260,17 +264,12 @@ int rrd_resize( rrd_write(rrd_out_file, &buffer, sizeof(rrd_value_t) * 1); l--; } -#ifndef HAVE_MMAP buffer = DNAN; l = rrdnew.stat_head->ds_cnt * modify; while (l > 0) { rrd_write(rrd_out_file, &buffer, sizeof(rrd_value_t) * 1); l--; } -#else - /* for the mmap case, we did already fill the whole new file with DNAN - * before we copied the old values, so nothing to do here. */ -#endif } else { /* Removing rows. Normally this would be just after the cursor ** however this may also mean that we wrap to the beginning of