]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix rows calculation in graph
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 2 Jul 2016 12:18:18 +0000 (13:18 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 2 Jul 2016 12:18:18 +0000 (13:18 +0100)
src/controller.c

index 4869573752bb726de549d2ecda5975262ddecc64..b45e5add5cb17a984b499a88d818b45280915ef3 100644 (file)
@@ -1170,7 +1170,8 @@ rspamd_controller_handle_graph (
        step = (rrd_result->rra_rows / desired_points + 0.5);
        acc = g_malloc0 (sizeof (double) * rrd_result->ds_count * step);
 
-       for (i = start_row, cnt = 0; cnt < rrd_result->rra_rows; cnt ++) {
+       for (i = start_row, cnt = 0; cnt < rrd_result->rra_rows;
+                       cnt ++) {
                for (j = 0; j < rrd_result->ds_count; j++) {
                        if (k < step) {
                                /* Just update window */
@@ -1187,7 +1188,13 @@ rspamd_controller_handle_graph (
                        }
                }
 
-               i = start_row == 0 ? i + 1 : (i + 1) % start_row;
+               if (i == rrd_result->rra_rows - 1) {
+                       i = 0;
+               }
+               else {
+                       i ++;
+               }
+
                ts ++;
        }