@@ -383,7 +383,10 @@ function __rrd_execute($command_line, $log_to_stdout, $output_flag, $rrdtool_pip
383383 break ;
384384 case RRDTOOL_OUTPUT_STDERR :
385385 case RRDTOOL_OUTPUT_RETURN_STDERR :
386- $ output = fgets ($ fp , 1000000 );
386+ $ output = '' ;
387+ while (!feof ($ fp )) {
388+ $ output .= fgets ($ fp , 4096 );
389+ }
387390
388391 if (isset ($ process )) {
389392 fclose ($ fp );
@@ -531,6 +534,7 @@ function __rrd_proxy_execute($command_line, $log_to_stdout, $output_flag, $rrdp=
531534 return rtrim (substr ($ output , 0 , strpos ($ output , 'OK u ' )));
532535 break ;
533536 case RRDTOOL_OUTPUT_STDERR :
537+ case RRDTOOL_OUTPUT_RETURN_STDERR :
534538 if (substr ($ output , 1 , 3 ) == 'PNG ' ) {
535539 return 'OK ' ;
536540 }
@@ -540,7 +544,11 @@ function __rrd_proxy_execute($command_line, $log_to_stdout, $output_flag, $rrdp=
540544 if (substr ($ output , 0 , 5 ) == '<?xml ' ) {
541545 return 'SVG/XML Output OK ' ;
542546 }
543- print $ output ;
547+ if ($ output_flag == RRDTOOL_OUTPUT_RETURN_STDERR ) {
548+ return $ output ;
549+ } else {
550+ print $ output ;
551+ }
544552 break ;
545553 case RRDTOOL_OUTPUT_BOOLEAN :
546554 return (substr_count ($ output , 'OK u ' )) ? true : false ;
@@ -1324,11 +1332,6 @@ function rrd_function_process_graph_options($graph_start, $graph_end, &$graph, &
13241332 /* Replace "|query_*|" in the graph command to replace e.g. vertical_label. */
13251333 $ graph_opts = rrd_substitute_host_query_data ($ graph_opts , $ graph , array ());
13261334
1327- /* provide smooth lines */
1328- if ($ graph ['slope_mode ' ] == 'on ' ) {
1329- $ graph_opts .= '--slope-mode ' . RRD_NL ;
1330- }
1331-
13321335 /* if the user desires a watermark set it */
13331336 $ watermark = str_replace ("' " , '" ' , read_config_option ('graph_watermark ' ));
13341337 if ($ watermark != '' ) {
@@ -1599,7 +1602,7 @@ function rrdtool_function_graph($local_graph_id, $rra_id, $graph_data_array, $rr
15991602 /* remember the last CF for this data source for use with GPRINT
16001603 * if e.g. an AREA/AVERAGE and a LINE/MAX is used
16011604 * we will have AVERAGE first and then MAX, depending on GPRINT sequence */
1602- $ last_graph_cf ['data_source_name ' ][ 'local_data_template_rrd_id ' ] = $ graph_cf ;
1605+ $ last_graph_cf [$ graph_item [ 'data_source_name ' ]][ $ graph_item [ 'local_data_template_rrd_id ' ] ] = $ graph_cf ;
16031606
16041607 /* remember this for second foreach loop */
16051608 $ graph_items [$ key ]['cf_reference ' ] = $ graph_cf ;
@@ -1612,8 +1615,8 @@ function rrdtool_function_graph($local_graph_id, $rra_id, $graph_data_array, $rr
16121615 * see 'man rrdgraph_data' for the correct VDEF based notation
16131616 * so our task now is to 'guess' the very graph_item, this GPRINT is related to
16141617 * and to use that graph_item's CF */
1615- if (isset ($ last_graph_cf ['data_source_name ' ][ 'local_data_template_rrd_id ' ])) {
1616- $ graph_cf = $ last_graph_cf ['data_source_name ' ][ 'local_data_template_rrd_id ' ];
1618+ if (isset ($ last_graph_cf [$ graph_item [ 'data_source_name ' ]][ $ graph_item [ 'local_data_template_rrd_id ' ] ])) {
1619+ $ graph_cf = $ last_graph_cf [$ graph_item [ 'data_source_name ' ]][ $ graph_item [ 'local_data_template_rrd_id ' ] ];
16171620 /* remember this for second foreach loop */
16181621 $ graph_items [$ key ]['cf_reference ' ] = $ graph_cf ;
16191622 } else {
@@ -2593,6 +2596,9 @@ function rrdtool_function_format_graph_date(&$graph_data_array) {
25932596 case GD_Y_MN_D :
25942597 $ graph_date = 'Y ' . $ datecharacter . 'M ' . $ datecharacter . 'd H:i:s ' ;
25952598 break ;
2599+ default :
2600+ $ graph_date = 'Y ' . $ datecharacter . 'm ' . $ datecharacter . 'd H:i:s ' ;
2601+ break ;
25962602 }
25972603
25982604 /* display the timespan for zoomed graphs */
@@ -3653,7 +3659,7 @@ function rrd_rra_clone($file_array, $cf, $rra_array, $debug) {
36533659 rrdtool_execute ("restore -f $ xml_file $ file " , false , RRDTOOL_OUTPUT_STDOUT , $ rrdtool_pipe , 'UTIL ' );
36543660 /* scratch that XML file to avoid filling up the disk */
36553661 unlink ($ xml_file );
3656- cacti_log ('Deleted RRA(s) from RRDfile: ' . $ file , false , 'UTIL ' );
3662+ cacti_log ('Cloned RRA(s) in RRDfile: ' . $ file , false , 'UTIL ' );
36573663 } else {
36583664 $ check ['err_msg ' ] = __ ('ERROR: RRDfile %s not writeable ' , $ file );
36593665 return $ check ;
@@ -4108,7 +4114,7 @@ function rrdtool_create_error_image($string, $width = '', $height = '') {
41084114 imagecopyresized ($ nimage , $ image , 0 , 0 , 0 , 0 , $ width , $ height , 450 , 200 );
41094115
41104116 /* create the image */
4111- imagepng ($ image );
4117+ imagepng ($ nimage );
41124118 } else {
41134119 /* create the image */
41144120 imagepng ($ image );
0 commit comments