mirror of
https://github.com/systemd/systemd.git
synced 2026-08-11 01:25:28 +00:00
tmpfiles: add hardening in glob_item_recursively
(cherry picked from commit001c5dfdf5) (cherry picked from commit872ad58935) (cherry picked from commit2e9cf18323)
This commit is contained in:
committed by
Luca Boccassi
parent
a94c15302e
commit
ec26a4dd29
@@ -2641,10 +2641,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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user