From a4291ece69adb1228bddf9be1e03e7dc135faa8b Mon Sep 17 00:00:00 2001 From: Basit Hasan Date: Thu, 19 May 2022 06:36:01 +0530 Subject: [PATCH] remove-directory-after-mounting --- src/mount_injector.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mount_injector.rs b/src/mount_injector.rs index 2ac35f9..8b3c792 100644 --- a/src/mount_injector.rs +++ b/src/mount_injector.rs @@ -2,6 +2,7 @@ use std::ffi::OsStr; use std::path::{Path, PathBuf}; use std::sync::Arc; use std::thread::JoinHandle; +use std::fs; use anyhow::{anyhow, Result}; use nix::mount::umount; @@ -62,6 +63,7 @@ impl MountInjectionGuard { if mounts.non_root(&original_path)? { // TODO: make the parent mount points private before move mount points mounts.move_mount(new_path, original_path)?; + fs::remove_dir(new_path)?; } else { return Err(anyhow!("inject on a root mount")); }