cap-std icon indicating copy to clipboard operation
cap-std copied to clipboard

tempfile: add new_with_modes and is_named methods

Open champtar opened this issue 5 months ago • 3 comments
trafficstars

On filesystems that do not support O_TMPFILE (e.g. vfat), TempFile::new() automatically falls back to a potentially world readable named temp file.

Add TempFile::new_with_modes() to create temp files with a chosen mode directly. We pass 2 modes, one for unnamed tempfile (happy path, created with O_TMPFILE), and one for named tempfile.

The final mode is still restricted by the process umask.

@cgwalters this will help improve cap-std-ext atomic* permissions handling

champtar avatar May 26 '25 09:05 champtar