]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
xopenat(): introduce new XO_REGULAR flag (#35834)
authorLennart Poettering <lennart@poettering.net>
Tue, 7 Jan 2025 07:55:56 +0000 (08:55 +0100)
committerGitHub <noreply@github.com>
Tue, 7 Jan 2025 07:55:56 +0000 (08:55 +0100)
This is something I think we should have added a long time ago: a
flavour of open() that safely ensures the inode we are opening is a
regular file, before we open it. It does this by means of pinning the
inode via O_PATH first, and after verification actually opening it.

This ports some code over to this, but sooner or later we should
probably use this a lot more, so that we don't accidentally open weird
stuff such as device nodes or pipes, where we should not.


Trivial merge