From: Lennart Poettering Date: Tue, 7 Jan 2025 07:55:56 +0000 (+0100) Subject: xopenat(): introduce new XO_REGULAR flag (#35834) X-Git-Tag: v258-rc1~1688 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=56a07d10a589be6c9c8883d23ad4642bafb42312;p=thirdparty%2Fsystemd.git xopenat(): introduce new XO_REGULAR flag (#35834) 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. --- 56a07d10a589be6c9c8883d23ad4642bafb42312