1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 09:56:51 +03:00

core/load-droping: avoid oom warning when the unit symlink is not a template

unit_name_template returns -EINVAL if the unit name is not a template, but
the code assumed that OOM is the only failure mode. Fix that to emit the warning
if a non-template unit is encountered (because in this case we expect the name
to match exactly), and just skip the warning on other errors (presumably oom).

Fixes #5543.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2017-05-20 19:34:50 -04:00
parent 4417e1a33d
commit e450032f09

View File

@ -38,10 +38,12 @@ static bool unit_name_compatible(const char *a, const char *b) {
return true;
r = unit_name_template(a, &prefix);
if (r < 0) {
log_oom();
if (r == -EINVAL)
/* not a template */
return false;
if (r < 0)
/* oom, or some other failure. Just skip the warning. */
return true;
}
/* an instance name points to a target that is just the template name */
if (streq(prefix, b))