Code

proper fix for the header size problem and its effects on rrd_resize
[rrdtool-all.git] / program / src / rrd_format.c
index 501b2676d95b6661966b85eadc9ba2b849285f99..5200b33703a4e065068997af0318b1dc015e1b54 100644 (file)
@@ -125,8 +125,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;