init: start timeout only if reaped PID is the initial process

Fix a very obvious bug introduced in 5401882ed0.

Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
Ophestra Umiker 2024-10-17 20:46:25 +09:00
parent 40161c5938
commit 919e5b5cd5
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q
1 changed files with 5 additions and 4 deletions

View File

@ -145,11 +145,12 @@ func doInit(fd uintptr) {
default: default:
r = 255 r = 255
} }
go func() {
time.Sleep(residualProcessTimeout)
close(timeout)
}()
} }
go func() {
time.Sleep(residualProcessTimeout)
close(timeout)
}()
case <-done: case <-done:
os.Exit(r) os.Exit(r)
case <-timeout: case <-timeout: