From 491668f3d83f763a11111151a3fc1f3d78cec3ab Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Wed, 8 Apr 2015 09:47:08 +0200
Subject: [PATCH] cli-status: don't return 0 if there is a problem older than
 limit

The loop should skip such a problem and not return from the counting
function with 0. This is an obvious bug introduced in
commit 58d8e83f58afb32db3bdfd5170e65dc0ef2d2ce0

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
 src/cli/status.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/cli/status.c b/src/cli/status.c
index 68bdd0e..a65ba05 100644
--- a/src/cli/status.c
+++ b/src/cli/status.c
@@ -30,16 +30,25 @@ static unsigned int count_problem_dirs(unsigned long since)
     {
         const char *problem_id = (const char *)iter->data;
         if (test_exist_over_dbus(problem_id, FILENAME_REPORTED_TO))
+        {
+            log_debug("Not counting problem %s: already reported", problem_id);
             continue;
+        }
 
         char *time_str = load_text_over_dbus(problem_id, FILENAME_LAST_OCCURRENCE);
         if (time_str == NULL)
+        {
+            log_debug("Not counting problem %s: failed to get time element", problem_id);
             continue;
+        }
 
         long val = atol(time_str);
         free(time_str);
         if (val < since)
-            return 0;
+        {
+            log_debug("Not counting problem %s: older tham limit (%ld < %ld)", problem_id, val, since);
+            continue;
+        }
 
         count++;
     }
-- 
2.1.0

