procd: add cancel_timeout on rc scripts when a runtime_timeout is specified
authorJurgen Van Ham <juvanham.tc@gmail.com>
Fri, 10 Feb 2017 06:55:23 +0000 (07:55 +0100)
committerJohn Crispin <john@phrozen.org>
Wed, 15 Feb 2017 08:56:40 +0000 (09:56 +0100)
Enable procd to restrict the execution time of a rc scripts during shutdown, even
when a script ignores the SIGTERM signal by insisting after 10s with a SIGKILL.

Signed-off-by: Jurgen Van Ham <juvanham.tc@gmail.com>
rcS.c

diff --git a/rcS.c b/rcS.c
index 1e38d39e511fd280904bc7b6f3b315eb7ff60b4f..0208a75ac76ac33a34d8f10f1978e5d9335a3e3e 100644 (file)
--- a/rcS.c
+++ b/rcS.c
@@ -121,8 +121,10 @@ static void add_initd(struct runqueue *q, char *file, char *param)
        }
        s->proc.task.type = &initd_type;
        s->proc.task.complete = q_initd_complete;
-       if (!strcmp(param, "stop") || !strcmp(param, "shutdown"))
+       if (!strcmp(param, "stop") || !strcmp(param, "shutdown")) {
                s->proc.task.run_timeout = 15000;
+               s->proc.task.cancel_timeout = 10000;
+       }
        s->param = p;
        s->file = f;
        strcpy(s->param, param);