Welcome to little lamb

Code » anopa » commit 999535f

start-stop: Ignore SIGINT so it doesn't break ftrigr

author Olivier Brunel
2015-04-21 19:21:42 UTC
committer Olivier Brunel
2015-04-21 19:21:42 UTC
parent 8ccab8e2bdd93dd54af91e1ba8290a0b803a1673

start-stop: Ignore SIGINT so it doesn't break ftrigr

Block SIGINT before aa_prepare_mainlist(), which will fork & exec the
s6-ftrigr helper, so a ^C/SIGINT won't break all pending s6 events.

src/anopa/start-stop.c +3 -0

diff --git a/src/anopa/start-stop.c b/src/anopa/start-stop.c
index 986f98c..ada245b 100644
--- a/src/anopa/start-stop.c
+++ b/src/anopa/start-stop.c
@@ -1188,6 +1188,9 @@ mainloop (aa_mode mode, aa_scan_cb scan_cb)
     iop.events = IOPAUSE_READ;
     genalloc_append (iopause_fd, &ga_iop, &iop);
 
+    /* ignore SIGINT so it will be blocked for s6-trigr, else a ^C would have
+     * SIGINT resulting in "Broken pipe" errors */
+    sig_ignore (SIGINT);
     iop.fd = aa_prepare_mainlist (prepare_cb, exec_cb);
     if (iop.fd < 0)
         strerr_diefu1sys (ERR_IO, "prepare mainlist");