summaryrefslogtreecommitdiffstats
path: root/src/core/load-dropin.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-05-21 01:34:50 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-05-21 01:34:50 +0200
commite450032f0990067c0076068774162265db99d22c (patch)
treec79b1211068f52cc9bb98fec660182647b6e70df /src/core/load-dropin.c
parentMerge pull request #5960 from keszybz/journald-memleak (diff)
downloadsystemd-e450032f0990067c0076068774162265db99d22c.tar.xz
systemd-e450032f0990067c0076068774162265db99d22c.zip
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.
Diffstat (limited to 'src/core/load-dropin.c')
-rw-r--r--src/core/load-dropin.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/load-dropin.c b/src/core/load-dropin.c
index ff3636149a..3180f911bb 100644
--- a/src/core/load-dropin.c
+++ b/src/core/load-dropin.c
@@ -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))