]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fd-util: do not block O_TMPFILE with -EISDIR 39736/head
authorMike Yuan <me@yhndnzj.com>
Fri, 14 Nov 2025 20:32:51 +0000 (21:32 +0100)
committerMike Yuan <me@yhndnzj.com>
Fri, 14 Nov 2025 20:51:28 +0000 (21:51 +0100)
Follow-up for 7cf4f075670a81babf1501f063f6841cc4e866dd

src/basic/fd-util.c

index 310f5b82b5bf094447ad264f02da122e03f6dd96..e0dcbcecd18ea022deb296934f34e4928835f60e 100644 (file)
@@ -978,7 +978,10 @@ int fd_vet_accmode(int fd, int mode) {
         if (flags < 0)
                 return -errno;
 
-        if (FLAGS_SET(flags, O_DIRECTORY))
+        /* O_TMPFILE in userspace is defined with O_DIRECTORY OR'ed in, so explicitly permit it.
+         *
+         * C.f. https://elixir.bootlin.com/linux/v6.17.7/source/include/uapi/asm-generic/fcntl.h#L92 */
+        if (FLAGS_SET(flags, O_DIRECTORY) && !FLAGS_SET(flags, O_TMPFILE))
                 return -EISDIR;
 
         if (FLAGS_SET(flags, O_PATH))