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 2024-10-17 20:46:25 +09:00
parent 40161c5938
commit 919e5b5cd5
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q

View File

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