conf-files: rework conf_files_list_with_replacement()

Previously, symlinks in the replacement was not chased, hence we may
inserted a path to outside of the root directory, or we may have wrong
judgement whether we should insert the replacement or not.

This makes the symlinks in the replacement also resolved.
Also, as the function is only used by tmpfiles and sysusers, this
enables CONF_FILES_REGULAR, CONF_FILES_CHASE_BASENAME, and
CONF_FILES_FILTER_MASKED_BY_SYMLINK flags.
This commit is contained in:
Yu Watanabe
2025-06-28 04:13:43 +09:00
parent 49653adef3
commit 41fb58595a
3 changed files with 243 additions and 140 deletions
+2 -3
View File
@@ -20,13 +20,12 @@ int conf_files_list_strv(char ***ret, const char *suffix, const char *root, Conf
int conf_files_list_strv_at(char ***ret, const char *suffix, int rfd, ConfFilesFlags flags, const char * const *dirs);
int conf_files_list_nulstr(char ***ret, const char *suffix, const char *root, ConfFilesFlags flags, const char *dirs);
int conf_files_list_nulstr_at(char ***ret, const char *suffix, int rfd, ConfFilesFlags flags, const char *dirs);
int conf_files_insert(char ***strv, const char *root, char **dirs, const char *path);
int conf_files_list_with_replacement(
const char *root,
char **config_dirs,
const char *replacement,
char ***files,
char **replace_file);
char ***ret_files,
char **ret_inserted);
int conf_files_list_dropins(
char ***ret,
const char *dropin_dirname,