Welcome to little lamb

Code » anopa » commit 5b8d3f4

Remove unneeded code

author Olivier Brunel
2017-01-27 19:00:57 UTC
committer Olivier Brunel
2017-06-18 12:30:35 UTC
parent 35f2755d8e6f07bb59e8f796a0eef54b65f4abe4

Remove unneeded code

Specifically, this shouldn't be needed anymore with recent s6 once
ftrigr_update() has been fixed to not include duplicates in the list.

If one happens to have an "old" s6, then some harmless warnings ("unable
to find longrun service for id #x") might be shown, is all.

src/libanopa/exec_longrun.c +1 -26

diff --git a/src/libanopa/exec_longrun.c b/src/libanopa/exec_longrun.c
index a05988b..c620f2a 100644
--- a/src/libanopa/exec_longrun.c
+++ b/src/libanopa/exec_longrun.c
@@ -248,33 +248,8 @@ aa_get_longrun_info (uint16 *id, char *event)
 int
 aa_unsubscribe_for (uint16 id)
 {
-    int r = 0;
     tain_t deadline;
 
     tain_addsec_g (&deadline, 1);
-    if (!ftrigr_unsubscribe_g (&_aa_ft, id, &deadline))
-        r = -1;
-    /* if it works, we need to remove any future iteration of that id in the
-     * _aa_ft.list, to avoid EINVAL from ftrigr_check() in aa_get_longrun_info()
-     * above, as more of this id could have been listed */
-    if (r == 0 && idx >= 0)
-    {
-        int i = genalloc_len (uint16, &_aa_ft.list);
-
-        for (--i; i >= idx; --i)
-        {
-            if (genalloc_s (uint16, &_aa_ft.list)[i] == id)
-            {
-                int len = genalloc_len (uint16, &_aa_ft.list);
-                int c = len - i - 1;
-
-                if (c > 0)
-                    byte_copy (genalloc_s (uint16, &_aa_ft.list) + i,
-                            c * sizeof (uint16),
-                            genalloc_s (uint16, &_aa_ft.list) + i + 1);
-                genalloc_setlen (uint16, &_aa_ft.list, len - 1);
-            }
-        }
-    }
-    return r;
+    return (ftrigr_unsubscribe_g (&_aa_ft, id, &deadline)) ? 0 : -1;
 }