[Libreoffice-commits] online.git: kit/ForKit.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Jan 30 05:11:24 UTC 2017
kit/ForKit.cpp | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
New commits:
commit 93858c5b9e7c61c33ac3c45710a351bf22f481d9
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun Jan 29 20:19:23 2017 -0500
wsd: forkit removes jails after reaping dead children
Change-Id: Ia4b8dd85b41fa59ececbed85e35616fee6a02254
Reviewed-on: https://gerrit.libreoffice.org/33678
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/kit/ForKit.cpp b/kit/ForKit.cpp
index ba3d548..b6383a8 100644
--- a/kit/ForKit.cpp
+++ b/kit/ForKit.cpp
@@ -182,21 +182,29 @@ static bool haveCorrectCapabilities()
/// Check if some previously forked kids have died.
static void cleanupChildren()
{
+ std::vector<std::string> jails;
Process::PID exitedChildPid;
int status;
while ((exitedChildPid = waitpid(-1, &status, WUNTRACED | WNOHANG)) > 0)
{
- if (childJails.find(exitedChildPid) != childJails.end())
+ const auto it = childJails.find(exitedChildPid);
+ if (it != childJails.end())
{
- LOG_INF("Child " << exitedChildPid << " has exited, removing its jail '" << childJails[exitedChildPid] << "'");
- FileUtil::removeFile(childJails[exitedChildPid], true);
- childJails.erase(exitedChildPid);
+ LOG_INF("Child " << exitedChildPid << " has exited, removing its jail '" << it->second << "'.");
+ jails.emplace_back(it->second);
+ childJails.erase(it);
}
else
{
LOG_ERR("Unknown child " << exitedChildPid << " has exited");
}
}
+
+ // Now delete the jails.
+ for (const auto& path : jails)
+ {
+ FileUtil::removeFile(path, true);
+ }
}
static int createLibreOfficeKit(const std::string& childRoot,
More information about the Libreoffice-commits
mailing list