From cc0d53d6a676b04c16ad2efe6f72db087c8246c7 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sun, 17 Jul 2022 14:43:21 +0200 Subject: [PATCH] LoginServer: Correctly retrieve SystemServer's exit code The returned value of `waitpid` is the PID of the process and not the exit code. --- Userland/Services/LoginServer/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Services/LoginServer/main.cpp b/Userland/Services/LoginServer/main.cpp index ed67f1e0db..1b4bb2392a 100644 --- a/Userland/Services/LoginServer/main.cpp +++ b/Userland/Services/LoginServer/main.cpp @@ -46,8 +46,8 @@ static void login(Core::Account const& account, LoginWindow& window) pid_t rc = waitpid(pid, &wstatus, 0); if (rc == -1) dbgln("waitpid failed: {}", strerror(errno)); - if (rc != 0) - dbgln("SystemServer exited with non-zero status: {}", rc); + if (WIFEXITED(wstatus) && WEXITSTATUS(wstatus) != 0) + dbgln("SystemServer exited with non-zero status: {}", WEXITSTATUS(wstatus)); window.show(); }