From 4fa5ace5b3a24c8af390df55407d4d0485f09418 Mon Sep 17 00:00:00 2001 From: utam0k Date: Sat, 10 Jun 2023 07:59:39 +0000 Subject: [PATCH] Don't create a file when it already exists when mounting with bind Signed-off-by: utam0k --- crates/libcontainer/src/rootfs/mount.rs | 2 +- hack/debug.bt | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/libcontainer/src/rootfs/mount.rs b/crates/libcontainer/src/rootfs/mount.rs index 647a71c698..cefa1a6aa7 100644 --- a/crates/libcontainer/src/rootfs/mount.rs +++ b/crates/libcontainer/src/rootfs/mount.rs @@ -497,7 +497,7 @@ impl Mount { err })?; - if src.is_file() { + if src.is_file() && !src.exists() { OpenOptions::new() .create(true) .write(true) diff --git a/hack/debug.bt b/hack/debug.bt index 6b1043300a..4d2e78dc8b 100755 --- a/hack/debug.bt +++ b/hack/debug.bt @@ -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);