mount: avoid hard-coding

Change-Id: I6857510a9d0442cc357886b453d369f1e4b8f53f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
pull/9014/head
Ashod Nakashian 2024-05-08 17:39:14 -04:00 committed by Michael Meeks
parent 4d8d1119a2
commit dac5c0341f
1 changed files with 5 additions and 2 deletions

View File

@ -32,6 +32,9 @@
namespace JailUtil
{
static const std::string CoolTestMountpoint = "cool_test_mount";
bool coolmount(const std::string& arg, std::string source, std::string target)
{
source = Util::trim(source, '/');
@ -181,7 +184,7 @@ bool tryRemoveJail(const std::string& root)
unmount(Poco::Path(root, "lo").toString());
// Unmount the test-mount directory too.
const std::string testMountPath = Poco::Path(root, "cool_test_mount").toString();
const std::string testMountPath = Poco::Path(root, CoolTestMountpoint).toString();
if (FileUtil::Stat(testMountPath).exists())
unmount(testMountPath);
@ -296,7 +299,7 @@ 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();
const std::string target = Poco::Path(childRoot, CoolTestMountpoint).toString();
// Make sure that we can both mount and unmount before enabling bind-mounting.
if (bind(sysTemplate, target) && unmount(target))