Skip to content

Commit

Permalink
remove-directory-after-mounting
Browse files Browse the repository at this point in the history
  • Loading branch information
basit9958 committed May 19, 2022
1 parent 67b43ee commit a4291ec
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mount_injector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"));
}
Expand Down

0 comments on commit a4291ec

Please sign in to comment.