X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_update.c;h=3e6376d40d7180c21ae8ff740b3afe583e61313b;hb=c3bba53a634a13b8b1c3ec17acebcb87adbd5632;hp=0e6012dc3247b5d7bf4d50ba99e6bf991708d3fc;hpb=a5eb18ad8c70e530a2e28ed435a0f52da0f5bee0;p=rrdtool.git diff --git a/src/rrd_update.c b/src/rrd_update.c index 0e6012d..3e6376d 100644 --- a/src/rrd_update.c +++ b/src/rrd_update.c @@ -1,6 +1,6 @@ /***************************************************************************** - * RRDtool 1.3rc8 Copyright by Tobi Oetiker, 1997-2008 + * RRDtool 1.3.1 Copyright by Tobi Oetiker, 1997-2008 ***************************************************************************** * rrd_update.c RRD Update Function ***************************************************************************** @@ -104,7 +104,7 @@ static int process_arg( char **updvals, long *tmpl_idx, unsigned long tmpl_cnt, - rrd_info_t **pcdp_summary, + rrd_info_t ** pcdp_summary, int version, unsigned long *skip_update, int *schedule_smooth); @@ -258,7 +258,7 @@ static int write_to_rras( unsigned long *rra_current, time_t current_time, unsigned long *skip_update, - rrd_info_t **pcdp_summary); + rrd_info_t ** pcdp_summary); static int write_RRA_row( rrd_file_t *rrd_file, @@ -266,7 +266,7 @@ static int write_RRA_row( unsigned long rra_idx, unsigned long *rra_current, unsigned short CDP_scratch_idx, - rrd_info_t **pcdp_summary, + rrd_info_t ** pcdp_summary, time_t rra_time); static int smooth_all_rras( @@ -322,7 +322,7 @@ rrd_info_t *rrd_update_v( char **argv) { char *tmplt = NULL; - rrd_info_t *result = NULL; + rrd_info_t *result = NULL; rrd_infoval_t rc; struct option long_options[] = { {"template", required_argument, 0, 't'}, @@ -428,7 +428,7 @@ int _rrd_update( const char *tmplt, int argc, const char **argv, - rrd_info_t *pcdp_summary) + rrd_info_t * pcdp_summary) { int arg_i = 2; @@ -502,6 +502,15 @@ int _rrd_update( rra_step_cnt, updvals, tmpl_idx, tmpl_cnt, &pcdp_summary, version, skip_update, &schedule_smooth) == -1) { + if (rrd_test_error()) { /* Should have error string always here */ + char *save_error; + + /* Prepend file name to error message */ + if ((save_error = strdup(rrd_get_error())) != NULL) { + rrd_set_error("%s: %s", filename, save_error); + free(save_error); + } + } free(arg_copy); break; } @@ -750,7 +759,7 @@ static int process_arg( char **updvals, long *tmpl_idx, unsigned long tmpl_cnt, - rrd_info_t **pcdp_summary, + rrd_info_t ** pcdp_summary, int version, unsigned long *skip_update, int *schedule_smooth) @@ -1855,7 +1864,7 @@ static int write_to_rras( unsigned long *rra_current, time_t current_time, unsigned long *skip_update, - rrd_info_t **pcdp_summary) + rrd_info_t ** pcdp_summary) { unsigned long rra_idx; unsigned long rra_start; @@ -1963,7 +1972,7 @@ static int write_RRA_row( unsigned long rra_idx, unsigned long *rra_current, unsigned short CDP_scratch_idx, - rrd_info_t **pcdp_summary, + rrd_info_t ** pcdp_summary, time_t rra_time) { unsigned long ds_idx, cdp_idx; @@ -1981,14 +1990,12 @@ static int write_RRA_row( iv.u_val = rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val; /* append info to the return hash */ *pcdp_summary = rrd_info_push(*pcdp_summary, - sprintf_alloc("[%d]RRA[%s][%lu]DS[%s]", - rra_time, - rrd->rra_def[rra_idx]. - cf_nam, - rrd->rra_def[rra_idx]. - pdp_cnt, - rrd->ds_def[ds_idx]. - ds_nam), RD_I_VAL, iv); + sprintf_alloc + ("[%d]RRA[%s][%lu]DS[%s]", rra_time, + rrd->rra_def[rra_idx].cf_nam, + rrd->rra_def[rra_idx].pdp_cnt, + rrd->ds_def[ds_idx].ds_nam), + RD_I_VAL, iv); } if (rrd_write(rrd_file, &(rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].