Skip to content

Commit

Permalink
Fix exceptions for special files
Browse files Browse the repository at this point in the history
This fixes sandboxing exceptions for special files on Linux. Previously
birdcage would explicitly panic.
  • Loading branch information
cd-work committed Oct 16, 2023
1 parent be10985 commit 88ce98f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/linux/namespaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,10 @@ fn copy_tree(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> Result<()> {

// Create target file/directory.
let metadata = src_sub.metadata()?;
if metadata.is_file() {
File::create(&dst)?;
} else if metadata.is_dir() {
if metadata.is_dir() {
fs::create_dir(&dst)?;
} else {
unreachable!("metadata call failed to follow symlink");
File::create(&dst)?;
}

// Copy permissions.
Expand Down

0 comments on commit 88ce98f

Please sign in to comment.