mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-04-29 06:06:15 +00:00
tree-wide: add missing O_CLOEXEC flags to openat
calls
Since we don't want to have lingering file descriptors on any fork + exec, like the reload code from the proxmox-daemon crate we're using for the rest-server(s) does, as that can have serious side effects and even cause hangs. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> [ TL: Reword commit message ]} Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
c17964e7fc
commit
8eaeedf31e
@ -57,7 +57,7 @@ impl PxarDir {
|
|||||||
let dir = Dir::openat(
|
let dir = Dir::openat(
|
||||||
parent,
|
parent,
|
||||||
self.file_name.as_os_str(),
|
self.file_name.as_os_str(),
|
||||||
OFlag::O_DIRECTORY,
|
OFlag::O_DIRECTORY | OFlag::O_CLOEXEC,
|
||||||
Mode::empty(),
|
Mode::empty(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ impl BackupGroup {
|
|||||||
match openat(
|
match openat(
|
||||||
l2_fd,
|
l2_fd,
|
||||||
&manifest_path,
|
&manifest_path,
|
||||||
OFlag::O_RDONLY,
|
OFlag::O_RDONLY | OFlag::O_CLOEXEC,
|
||||||
nix::sys::stat::Mode::empty(),
|
nix::sys::stat::Mode::empty(),
|
||||||
) {
|
) {
|
||||||
Ok(rawfd) => {
|
Ok(rawfd) => {
|
||||||
|
@ -102,7 +102,7 @@ impl SnapshotReader {
|
|||||||
let raw_fd = nix::fcntl::openat(
|
let raw_fd = nix::fcntl::openat(
|
||||||
self.locked_dir.as_raw_fd(),
|
self.locked_dir.as_raw_fd(),
|
||||||
Path::new(filename),
|
Path::new(filename),
|
||||||
nix::fcntl::OFlag::O_RDONLY,
|
nix::fcntl::OFlag::O_RDONLY | nix::fcntl::OFlag::O_CLOEXEC,
|
||||||
nix::sys::stat::Mode::empty(),
|
nix::sys::stat::Mode::empty(),
|
||||||
)?;
|
)?;
|
||||||
let file = unsafe { File::from_raw_fd(raw_fd) };
|
let file = unsafe { File::from_raw_fd(raw_fd) };
|
||||||
|
Loading…
Reference in New Issue
Block a user