summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 8467ea6e..b0f8b66c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -5,6 +5,7 @@
#include "init/initHelpers.hpp"
#include "debug/HyprCtl.hpp"
+#include <csignal>
#include <cstdio>
#include <hyprutils/string/String.hpp>
#include <hyprutils/memory/Casts.hpp>
@@ -35,6 +36,17 @@ static void help() {
--version -v - Print this binary's version)");
}
+static void reapZombieChildrenAutomatically() {
+ struct sigaction act;
+ act.sa_handler = SIG_DFL;
+ sigemptyset(&act.sa_mask);
+ act.sa_flags = SA_NOCLDWAIT;
+#ifdef SA_RESTORER
+ act.sa_restorer = NULL;
+#endif
+ sigaction(SIGCHLD, &act, nullptr);
+}
+
int main(int argc, char** argv) {
if (!getenv("XDG_RUNTIME_DIR"))
@@ -183,6 +195,8 @@ int main(int argc, char** argv) {
if (!envEnabled("HYPRLAND_NO_RT"))
NInit::gainRealTime();
+ reapZombieChildrenAutomatically();
+
Debug::log(LOG, "Hyprland init finished.");
// If all's good to go, start.