core: Fix typo and check correct grandchild PID in spawn() (#34)

This commit is contained in:
Lucas Reis 2024-03-11 14:14:34 -04:00 committed by GitHub
parent 029f08805a
commit 4395339a2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -249,9 +249,9 @@ static void spawn(const std::string& args) {
close(socket[1]); close(socket[1]);
read(socket[0], &grandchild, sizeof(grandchild)); read(socket[0], &grandchild, sizeof(grandchild));
close(socket[0]); close(socket[0]);
// clear child and leave child to init // clear child and leave grandchild to init
waitpid(child, NULL, 0); waitpid(child, NULL, 0);
if (child < 0) { if (grandchild < 0) {
Debug::log(LOG, "Failed to create the second fork"); Debug::log(LOG, "Failed to create the second fork");
return; return;
} }