blob: 0a9c174ccd4e87b44ca31de30be24d1a9a95265e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
From 809545f76af15841cf5e199b808afb72fef20572 Mon Sep 17 00:00:00 2001
From: Masato TOYOSHIMA <phoepsilonix@phoepsilonix.love>
Date: Fri, 20 Oct 2023 00:40:39 +0900
Subject: [PATCH] Zombie Process Prevention
If you start and close the mozc_tool,
there are cases where the zombie process remains,
so prevent it.
---
src/base/process.cc | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/base/process.cc b/src/base/process.cc
index 56bbcb1..a20a00d 100644
--- a/src/base/process.cc
+++ b/src/base/process.cc
@@ -213,6 +213,19 @@ bool Process::SpawnProcess(const std::string &path, const std::string &arg,
#endif // __linux__
pid_t tmp_pid = 0;
+#ifdef __linux__
+ // Zombie Process Prevention
+ // If you start and close the mozc_tool,
+ // there are cases where the zombie process remains,
+ // so prevent it.
+ struct sigaction sa;
+ sa.sa_handler = SIG_IGN;
+ sa.sa_flags = SA_NOCLDWAIT;
+ if (sigaction(SIGCHLD, &sa, NULL) == -1) {
+ LOG(ERROR) << "sigaction() failed: " << strerror(errno);
+ }
+#endif // __linux__
+
// Spawn new process.
// NOTE:
// posix_spawn returns 0 even if kMozcServer doesn't exist, because
--
2.42.0
|