mirror of
https://github.com/systemd/systemd.git
synced 2024-11-07 18:27:04 +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:
parent
4417e1a33d
commit
e450032f09
@ -38,10 +38,12 @@ static bool unit_name_compatible(const char *a, const char *b) {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
r = unit_name_template(a, &prefix);
|
r = unit_name_template(a, &prefix);
|
||||||
if (r < 0) {
|
if (r == -EINVAL)
|
||||||
log_oom();
|
/* not a template */
|
||||||
|
return false;
|
||||||
|
if (r < 0)
|
||||||
|
/* oom, or some other failure. Just skip the warning. */
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
/* an instance name points to a target that is just the template name */
|
/* an instance name points to a target that is just the template name */
|
||||||
if (streq(prefix, b))
|
if (streq(prefix, b))
|
||||||
|
Loading…
Reference in New Issue
Block a user