wsd: mount: safeRemoveDir will not error when unmount fails
safeRemoveDir is tries to unmount blindly, so there is little point in erroring when the directory in question isn't a mount-point at all. Change-Id: I6db0fd9406493060ce52a69f7d935b0958e2d2be Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This commit is contained in:
parent
dac5c0341f
commit
b33f822871
1 changed files with 3 additions and 3 deletions
|
@ -88,7 +88,7 @@ bool remountReadonly(const std::string& source, const std::string& target)
|
|||
}
|
||||
|
||||
/// Unmount a bind-mounted jail directory.
|
||||
static bool unmount(const std::string& target)
|
||||
static bool unmount(const std::string& target, bool silent = false)
|
||||
{
|
||||
LOG_DBG("Unmounting [" << target << ']');
|
||||
const bool res = coolmount("-u", "", target);
|
||||
|
@ -100,7 +100,7 @@ static bool unmount(const std::string& target)
|
|||
// Otherwise, it's a cleanup attempt of earlier mounts,
|
||||
// which may be left-over and now the config has changed.
|
||||
// This happens more often in dev labs than in prod.
|
||||
if (JailUtil::isBindMountingEnabled())
|
||||
if (JailUtil::isBindMountingEnabled() && !silent)
|
||||
LOG_ERR("Failed to unmount [" << target << ']');
|
||||
else
|
||||
LOG_DBG("Failed to unmount [" << target << ']');
|
||||
|
@ -139,7 +139,7 @@ bool isJailCopied(const std::string& root)
|
|||
static bool safeRemoveDir(const std::string& path)
|
||||
{
|
||||
// Always unmount, just in case.
|
||||
unmount(path);
|
||||
unmount(path, /*silent=*/true);
|
||||
|
||||
// Regardless of the bind flag, check if the jail is marked as copied.
|
||||
const bool copied = isJailCopied(path);
|
||||
|
|
Loading…
Reference in a new issue