Code

proper fix for the header size problem and its effects on rrd_resize
[rrdtool-all.git] / program / src / rrd_format.c
index 221dcd71f31723f71b23de27ca479bf2e602e91c..21d81d8d1686b7061f0ae391d0deb71aae5d5996 100644 (file)
@@ -105,8 +105,7 @@ off_t rrd_get_header_size(
     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;