mirror of
https://github.com/systemd/systemd.git
synced 2026-11-06 21:36:59 +00:00
sd_device_open() is public API and keeps returning non-cloexec fds unless the caller passes O_CLOEXEC. So every internal caller has to remember to pass it and storage-block.c didn't, so the block device fds it opens aren't O_CLOEXEC. Move the open logic into device_open() which always sets O_CLOEXEC, like our other open helpers do, and turn sd_device_open() into a wrapper that clears it again if the caller didn't ask for it. Use device_open() for all internal callers, which also makes device_open_from_devnum() set O_CLOEXEC on its own, and drop O_CLOEXEC from all the callers. Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>