47a88a
From ff8155d284dac74ae776d08de064e1cea17675be Mon Sep 17 00:00:00 2001
47a88a
From: Jakub Filak <jfilak@redhat.com>
47a88a
Date: Wed, 8 Apr 2015 09:47:08 +0200
47a88a
Subject: [PATCH] cli-status: don't return 0 if there is a problem older than
47a88a
 limit
47a88a
47a88a
The loop should skip such a problem and not return from the counting
47a88a
function with 0. This is an obvious bug introduced in
47a88a
commit 58d8e83f58afb32db3bdfd5170e65dc0ef2d2ce0
47a88a
47a88a
Related: #1224984
47a88a
47a88a
Signed-off-by: Jakub Filak <jfilak@redhat.com>
47a88a
---
47a88a
 src/cli/status.c | 11 ++++++++++-
47a88a
 1 file changed, 10 insertions(+), 1 deletion(-)
47a88a
47a88a
diff --git a/src/cli/status.c b/src/cli/status.c
47a88a
index 68bdd0e..a65ba05 100644
47a88a
--- a/src/cli/status.c
47a88a
+++ b/src/cli/status.c
47a88a
@@ -30,16 +30,25 @@ static unsigned int count_problem_dirs(unsigned long since)
47a88a
     {
47a88a
         const char *problem_id = (const char *)iter->data;
47a88a
         if (test_exist_over_dbus(problem_id, FILENAME_REPORTED_TO))
47a88a
+        {
47a88a
+            log_debug("Not counting problem %s: already reported", problem_id);
47a88a
             continue;
47a88a
+        }
47a88a
 
47a88a
         char *time_str = load_text_over_dbus(problem_id, FILENAME_LAST_OCCURRENCE);
47a88a
         if (time_str == NULL)
47a88a
+        {
47a88a
+            log_debug("Not counting problem %s: failed to get time element", problem_id);
47a88a
             continue;
47a88a
+        }
47a88a
 
47a88a
         long val = atol(time_str);
47a88a
         free(time_str);
47a88a
         if (val < since)
47a88a
-            return 0;
47a88a
+        {
47a88a
+            log_debug("Not counting problem %s: older tham limit (%ld < %ld)", problem_id, val, since);
47a88a
+            continue;
47a88a
+        }
47a88a
 
47a88a
         count++;
47a88a
     }
47a88a
-- 
47a88a
2.4.3
47a88a