Skip to content

Commit

Permalink
Don't create a file when it already exists when mounting with bind
Browse files Browse the repository at this point in the history
Signed-off-by: utam0k <[email protected]>
  • Loading branch information
utam0k committed Jun 11, 2023
1 parent 2bd6ebc commit 4d0bb73
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion crates/libcontainer/src/rootfs/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ impl Mount {
err
})?;

if src.is_file() {
if src.is_file() && !dest.exists() {
OpenOptions::new()
.create(true)
.write(true)
Expand Down
2 changes: 0 additions & 2 deletions hack/debug.bt
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ tracepoint:syscalls:sys_enter_setresuid
printf("ruid=%d, euid=%d, suid=%d\n", args->ruid, args->euid, args->suid);
}



END
{
clear(@filename);
Expand Down

0 comments on commit 4d0bb73

Please sign in to comment.