summaryrefslogtreecommitdiff
path: root/Kernel/Process.cpp
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@serenityos.org>2020-02-06 16:02:49 +0300
committerSergey Bugaev <bugaevc@serenityos.org>2020-02-06 16:06:30 +0300
commit1b866bbf42a46afff276f503c1f09844ef5d924a (patch)
treea5a4eaf5a296ff7fcb955a88ed2d801a812a7c88 /Kernel/Process.cpp
parentf46d80ac4fc2d9c4d3da9baf5515d2af9c577596 (diff)
downloadserenity-1b866bbf42a46afff276f503c1f09844ef5d924a.zip
Kernel: Fix sys$waitid(P_ALL, WNOHANG) return value
According to POSIX, waitid() should fill si_signo and si_pid members with zeroes if there are no children that have already changed their state by the time of the call. Let's just fill the whole structure with zeroes to avoid leaking kernel memory.
Diffstat (limited to 'Kernel/Process.cpp')
-rw-r--r--Kernel/Process.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index c1a3092f82..86d5749dd6 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -2314,7 +2314,7 @@ KResultOr<siginfo_t> Process::do_waitid(idtype_t idtype, int id, int options)
// FIXME: Figure out what WNOHANG should do with stopped children.
if (idtype == P_ALL) {
InterruptDisabler disabler;
- siginfo_t siginfo;
+ siginfo_t siginfo = { 0 };
for_each_child([&siginfo](Process& process) {
if (process.is_dead())
siginfo = reap(process);