From dda28efd6618d74df0c3def0d6a2d70a1cd33817 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 11 Jul 2022 20:47:57 +0530 Subject: [PATCH] Use the same signal to stop as stopped the child --- prewarm-launcher.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/prewarm-launcher.c b/prewarm-launcher.c index 0eca3d43b..2c319f1c5 100644 --- a/prewarm-launcher.c +++ b/prewarm-launcher.c @@ -383,14 +383,18 @@ read_from_zygote(void) { if (signum > 0) { signal(signum, SIG_DFL); cleanup(); - kill(getpid(), signum); + raise(signum); _exit(1); } } else if (WIFSTOPPED(child_exit_status)) { child_state = CHILD_STOPPED; + int signum = WSTOPSIG(child_exit_status); safe_tcsetattr(self_ttyfd, TCSANOW, &restore_termios); termios_needs_restore = false; - kill(getpid(), SIGSTOP); + struct sigaction defval = {.sa_handler = SIG_DFL}, original; + sigaction(signum, &defval, &original); + raise(signum); + sigaction(signum, &original, NULL); safe_tcsetattr(self_ttyfd, TCSANOW, &self_termios); termios_needs_restore = true; if (child_pid > 0) {