diff --git a/src/mount_injector.rs b/src/mount_injector.rs index 2ac35f9..98df89a 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; @@ -61,7 +62,8 @@ 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)?; + mounts.move_mount(&new_path, original_path)?; + fs::remove_dir(new_path)?; } else { return Err(anyhow!("inject on a root mount")); }