From 07da3912ec365e1bb33a40ce940a0d783e8f6cad Mon Sep 17 00:00:00 2001 From: jiung-yu Date: Fri, 10 Dec 2021 12:21:42 +0900 Subject: [PATCH] Locate signal handler at head of the loop Description: toybox dhcpd daemon have some problem when it receives SIGTERM. When it occurs, dhcpd can't be killed and CPU usage rises up to 100% Change-Id: I6499f0fc8a8554737c9982b4eaf1125e99eed52b Signed-off-by: Yu jiung --- toys/pending/dhcpd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toys/pending/dhcpd.c b/toys/pending/dhcpd.c index e30c249..1fc2e87 100644 --- a/toys/pending/dhcpd.c +++ b/toys/pending/dhcpd.c @@ -1733,7 +1733,7 @@ void dhcpd_main(void) unsigned char sig; if (read(sigfd.rd, &sig, 1) != 1) { dbg("signal read failed.\n"); - continue; + exit(0); } switch (sig) { case SIGUSR1: -- 2.7.4