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

This commit is contained in:
Lucas Reis 2024-03-11 15:31:39 -04:00 committed by GitHub
parent 66330281ff
commit 0fc9d45e4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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