Init: exit if the primary child process exits

This commit is contained in:
apio 2022-10-19 20:33:59 +02:00
parent 51665a04b7
commit 20db8eaba6

View File

@ -67,11 +67,14 @@ int main()
return 1; return 1;
} }
pid_t result;
for (;;) for (;;)
{ {
while (wait(NULL) == 0) // No child has exited yet while ((result = wait(NULL)) == 0) // No child has exited yet
{ {
msleep(100); msleep(100);
} }
if (result == child) { return 0; }
} }
} }