summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/JailUtil.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/common/JailUtil.cpp b/common/JailUtil.cpp
index 98336581fb..5c9531b9ad 100644
--- a/common/JailUtil.cpp
+++ b/common/JailUtil.cpp
@@ -220,7 +220,9 @@ void setupChildRoot(bool bindMount, const std::string& childRoot, const std::str
// Test mounting to verify it actually works,
// as it might not function in some systems.
const std::string target = Poco::Path(childRoot, "cool_test_mount").toString();
- if (bind(sysTemplate, target))
+
+ // Make sure that we can both mount and unmount before enabling bind-mounting.
+ if (bind(sysTemplate, target) && unmount(target))
{
enableBindMounting();
safeRemoveDir(target);