]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tmpfiles: add hardening in glob_item_recursively
authorAndres Beltran <abeltran@microsoft.com>
Wed, 8 Jul 2026 19:06:16 +0000 (19:06 +0000)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 8 Jul 2026 21:50:55 +0000 (22:50 +0100)
src/tmpfiles/tmpfiles.c

index 923c2c60f74eda69ab764d306225f0f8e0dd409f..5d914bc4ba5aeb403f337da3a407d38fef59590f 100644 (file)
@@ -2897,10 +2897,9 @@ static int glob_item_recursively(
                 /* Make sure we won't trigger/follow file object (such as device nodes, automounts, ...)
                  * pointed out by 'fn' with O_PATH. Note, when O_PATH is used, flags other than
                  * O_CLOEXEC, O_DIRECTORY, and O_NOFOLLOW are ignored. */
-
-                fd = open(*fn, O_CLOEXEC|O_NOFOLLOW|O_PATH);
+                fd = path_open_safe(*fn);
                 if (fd < 0) {
-                        RET_GATHER(r, log_error_errno(errno, "Failed to open '%s': %m", *fn));
+                        RET_GATHER(r, fd);
                         continue;
                 }