Welcome to little lamb

Code » anopa » commit 696f5d2

start/stop: Fix getting longrun name

author Olivier Brunel
2017-01-24 17:53:33 UTC
committer Olivier Brunel
2017-06-18 12:27:12 UTC
parent 3753fcf2c372c9a3dbcf2adae7d6092206440244

start/stop: Fix getting longrun name

src/anopa/start-stop.c +8 -5

diff --git a/src/anopa/start-stop.c b/src/anopa/start-stop.c
index bbe01cb..78f1643 100644
--- a/src/anopa/start-stop.c
+++ b/src/anopa/start-stop.c
@@ -2,7 +2,7 @@
  * anopa - Copyright (C) 2015-2017 Olivier Brunel
  *
  * start-stop.c
- * Copyright (C) 2015-2016 Olivier Brunel <jjk@jjacky.com>
+ * Copyright (C) 2015-2017 Olivier Brunel <jjk@jjacky.com>
  *
  * This file is part of anopa.
  *
@@ -190,12 +190,15 @@ draw_waiting (int already_drawn)
         int j;
 
         j = n - genalloc_len (pid_t, &ga_pid);
-        for (i = 0; i < l && j < n; ++i)
+        for (i = 0; i < l && j > 0; ++i)
             if (aa_service (list_get (&aa_main_list, i))->ft_id > 0)
-                ++j;
-        if (j < n)
+                --j;
+        if (j > 0)
+        {
+            aa_strerr_warnu1x ("find longrun service -- THIS IS A BUG!");
             return;
-        si = list_get (&aa_main_list, i);
+        }
+        si = list_get (&aa_main_list, i - 1);
     }
 
     if (!tain_sub (&ts, &STAMP, &aa_service (si)->ts_exec))