From 0fc9d45e4be40cb148fcee2ae6a0574ae63f29aa Mon Sep 17 00:00:00 2001 From: Lucas Reis Date: Mon, 11 Mar 2024 15:31:39 -0400 Subject: [PATCH] core: Fix typo and check grandchild PID in spawn() (#5070) --- src/managers/KeybindManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 6bcc7d3d..5178e848 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -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; }