proxmox/proxmox-sys
Dominik Csapak 0547659e2c sys: fs: set CLOEXEC when creating temp files
In general we want all open files to have set CLOEXEC since our
reloading mechanism can basically fork at any moment and we don't want
newer daemons to carry around old file descriptors, especially lock
files.

Since `make_tmp_file` is called by many things (e.g. open_file_locked,
logrotate, rrd), set O_CLOEXEC with mkostemp.

This fixes issues with leftover file descriptors e.g. tape backups not
working because of lingering locks after a reload, or having deleted
rrd files open.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-12-02 16:59:44 +01:00
..
debian tree-wide: check in d/control meta changes for newer debcargo 2024-11-26 14:44:33 +01:00
src sys: fs: set CLOEXEC when creating temp files 2024-12-02 16:59:44 +01:00
tests run cargo fmt 2024-06-24 10:02:31 +02:00
Cargo.toml tree-wide: unify workspace inherited attributes 2024-09-20 08:42:45 +02:00