return unit_file_lookup_state(scope, &lp, name, ret);
}
-int unit_file_exists_full(RuntimeScope scope, const LookupPaths *lp, const char *name, char **ret_path) {
+int unit_file_exists_full(
+ RuntimeScope scope,
+ const LookupPaths *lp,
+ bool follow,
+ const char *name,
+ char **ret_path) {
+
_cleanup_(install_context_done) InstallContext c = {
.scope = scope,
};
&c,
lp,
name,
- /* flags= */ 0,
+ follow ? SEARCH_FOLLOW_CONFIG_SYMLINKS : 0,
ret_path ? &info : NULL,
/* changes= */ NULL,
/* n_changes= */ NULL);
int unit_file_get_state(RuntimeScope scope, const char *root_dir, const char *filename, UnitFileState *ret);
-int unit_file_exists_full(RuntimeScope scope, const LookupPaths *lp, const char *name, char **ret_path);
+int unit_file_exists_full(
+ RuntimeScope scope,
+ const LookupPaths *lp,
+ bool follow,
+ const char *name,
+ char **ret_path);
+
static inline int unit_file_exists(RuntimeScope scope, const LookupPaths *lp, const char *name) {
- return unit_file_exists_full(scope, lp, name, NULL);
+ return unit_file_exists_full(scope, lp, false, name, NULL);
}
int unit_file_get_list(RuntimeScope scope, const char *root_dir, char * const *states, char * const *patterns, Hashmap **ret);
return r;
_cleanup_free_ char *found_sshd_template_unit = NULL;
- r = unit_file_exists_full(RUNTIME_SCOPE_SYSTEM, &lp, "sshd@.service", &found_sshd_template_unit);
+ r = unit_file_exists_full(RUNTIME_SCOPE_SYSTEM, &lp,
+ /* follow = */ true,
+ "sshd@.service",
+ &found_sshd_template_unit);
if (r < 0)
return log_error_errno(r, "Unable to detect if sshd@.service exists: %m");