diff -Nru stud-0.3/debian/changelog stud-0.3/debian/changelog --- stud-0.3/debian/changelog 2013-06-08 23:11:29.000000000 +0200 +++ stud-0.3/debian/changelog 2013-10-31 14:41:40.000000000 +0100 @@ -1,3 +1,11 @@ +stud (0.3-5ubuntu1) saucy; urgency=low + + * debian/patches/kill-children-on-sigterm.patch + Fix stud to handle termination of children processes + (LP: #1123950) + + -- Louis Bouchard Thu, 31 Oct 2013 14:41:11 +0100 + stud (0.3-5) unstable; urgency=low * Fix FTBFS when using --as-needed on non x86 arch. diff -Nru stud-0.3/debian/control stud-0.3/debian/control --- stud-0.3/debian/control 2013-06-08 23:11:29.000000000 +0200 +++ stud-0.3/debian/control 2013-10-31 14:43:39.000000000 +0100 @@ -1,7 +1,8 @@ Source: stud Section: net Priority: extra -Maintainer: Debian stud Maintainers +Maintainer: Ubuntu Developers +XSBC-Original-Maintainer: Debian stud Maintainers Uploaders: Vincent Bernat Build-Depends: debhelper (>= 8.1.3~), libev-dev (>= 1:4), libssl-dev (>=1.0.0) Standards-Version: 3.9.4 diff -Nru stud-0.3/debian/patches/kill-children-on-sigterm.patch stud-0.3/debian/patches/kill-children-on-sigterm.patch --- stud-0.3/debian/patches/kill-children-on-sigterm.patch 1970-01-01 01:00:00.000000000 +0100 +++ stud-0.3/debian/patches/kill-children-on-sigterm.patch 2013-10-31 13:06:08.000000000 +0100 @@ -0,0 +1,63 @@ +Description: Fix to handle children termination + +Author: Louis Bouchard +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/stud/+bug/1123950 +--- + +Index: stud-0.3/stud.c +=================================================================== +--- stud-0.3.orig/stud.c 2013-10-24 15:05:33.624471842 +0200 ++++ stud-0.3/stud.c 2013-10-24 15:07:41.504479870 +0200 +@@ -1217,6 +1217,21 @@ + } + } + ++/* Handle children process termination. ++ Display error if needed but continue and ++ exits at the end of the list */ ++static void terminate_children() ++{ ++ int i = 0; ++ ++ for (i = 0; i < OPTIONS.NCORES; i++) { ++ if (kill(child_pids[i], SIGTERM) < 0) { ++ perror("stud:terminate_children - "); ++ } ++ } ++ exit(0); ++} ++ + void init_signals() { + struct sigaction act; + +@@ -1238,6 +1253,21 @@ + fail("sigaction - sigchld"); + } + ++ ++/* Enable specific SIGTERM handling by the parent proc ++ It becomes responsible for terminating children. */ ++void handle_sigterm() { ++ struct sigaction act; ++ ++ sigemptyset(&act.sa_mask); ++ act.sa_flags = 0; ++ ++ act.sa_handler = terminate_children; ++ ++ if (sigaction(SIGTERM, &act, NULL) < 0) ++ fail("sigaction - sigterm"); ++} ++ + /* Process command line args, create the bound socket, + * spawn child (worker) processes, and respawn if any die */ + int main(int argc, char **argv) { +@@ -1262,6 +1292,8 @@ + + start_children(0, OPTIONS.NCORES); + ++ handle_sigterm(); ++ + for (;;) { + /* Sleep and let the children work. + * Parent will be woken up if a signal arrives */ diff -Nru stud-0.3/debian/patches/series stud-0.3/debian/patches/series --- stud-0.3/debian/patches/series 2013-06-08 23:11:29.000000000 +0200 +++ stud-0.3/debian/patches/series 2013-10-31 13:03:35.000000000 +0100 @@ -2,3 +2,4 @@ enable-hardening.diff kfreebsd-no-keepidle.patch as-needed.patch +kill-children-on-sigterm.patch