From: oetiker Date: Fri, 1 Jun 2007 17:35:46 +0000 (+0000) Subject: Bernhard X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a693e217c9af0441164875a61d662df70852933d;p=rrdtool-all.git Bernhard - fill the file with DNAN and add the remaining data in after the fact ... git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@1098 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/program/src/rrd_open.c b/program/src/rrd_open.c index 7812da18..e8391845 100644 --- a/program/src/rrd_open.c +++ b/program/src/rrd_open.c @@ -253,6 +253,7 @@ rrd_file_t *rrd_open( } rrd_file->file_start = data; if (rdwr & RRD_CREAT) { + memset(data, DNAN, newfile_size - 1); goto out_done; } #endif diff --git a/program/src/rrd_resize.c b/program/src/rrd_resize.c index 55ced9ec..b242b482 100644 --- a/program/src/rrd_resize.c +++ b/program/src/rrd_resize.c @@ -169,12 +169,17 @@ 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