Browse Source

procd: add cancel_timeout on rc scripts when a runtime_timeout is specified

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>
Jurgen Van Ham 7 years ago
parent
commit
5f91241034
1 changed files with 3 additions and 1 deletions
  1. 3 1
      rcS.c

+ 3 - 1
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);