diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-12-20 19:12:34 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-01-10 12:20:18 +0100 |
commit | 9a4f9e69e10886a45549264b83b1c02c345c572f (patch) | |
tree | fa90b0f09ffc4b9184c84089211ff1114dc7b475 /src/core/load-dropin.c | |
parent | b59817b199f3613c63cef36db63986b621dfc92a (diff) | |
download | systemd-9a4f9e69e10886a45549264b83b1c02c345c572f.tar.gz |
shared/unit-file: expose function to check .wants/.requires symlink validity
No functional change.
Diffstat (limited to 'src/core/load-dropin.c')
-rw-r--r-- | src/core/load-dropin.c | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/src/core/load-dropin.c b/src/core/load-dropin.c index a50b200f5b..492e816e91 100644 --- a/src/core/load-dropin.c +++ b/src/core/load-dropin.c @@ -11,24 +11,6 @@ #include "unit-name.h" #include "unit.h" -static int unit_name_compatible(const char *a, const char *b) { - _cleanup_free_ char *template = NULL; - int r; - - /* The straightforward case: the symlink name matches the target */ - if (streq(a, b)) - return 1; - - r = unit_name_template(a, &template); - if (r == -EINVAL) - return 0; /* Not a template */ - if (r < 0) - return r; /* OOM, or some other failure. Just skip the warning. */ - - /* An instance name points to a target that is just the template name */ - return streq(template, b); -} - static int process_deps(Unit *u, UnitDependency dependency, const char *dir_suffix) { _cleanup_strv_free_ char **paths = NULL; char **p; @@ -83,9 +65,10 @@ static int process_deps(Unit *u, UnitDependency dependency, const char *dir_suff /* We don't treat this as an error, especially because we didn't check this for a * long time. Nevertheless, we warn, because such mismatch can be mighty confusing. */ - r = unit_name_compatible(entry, basename(target)); + r = unit_symlink_name_compatible(entry, basename(target)); if (r < 0) { - log_unit_warning_errno(u, r, "Can't check if names %s and %s are compatible, ignoring: %m", entry, basename(target)); + log_unit_warning_errno(u, r, "Can't check if names %s and %s are compatible, ignoring: %m", + entry, basename(target)); continue; } if (r == 0) |