|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
From 90c0dc446632c7b5b2ed6251e0ce94c714b5a180 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
Date: Sat, 20 May 2017 19:34:50 -0400
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
Subject: [PATCH] core/load-droping: avoid oom warning when the unit symlink is
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
not a template
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
unit_name_template returns -EINVAL if the unit name is not a template, but
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
the code assumed that OOM is the only failure mode. Fix that to emit the warning
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
if a non-template unit is encountered (because in this case we expect the name
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
to match exactly), and just skip the warning on other errors (presumably oom).
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
Fixes #5543.
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
(cherry picked from commit e450032f0990067c0076068774162265db99d22c)
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
src/core/load-dropin.c | 8 +++++---
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
1 file changed, 5 insertions(+), 3 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
diff --git a/src/core/load-dropin.c b/src/core/load-dropin.c
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
index ff3636149a..3180f911bb 100644
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
--- a/src/core/load-dropin.c
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
+++ b/src/core/load-dropin.c
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
@@ -38,10 +38,12 @@ static bool unit_name_compatible(const char *a, const char *b) {
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
return true;
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
r = unit_name_template(a, &prefix);
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
- if (r < 0) {
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
- log_oom();
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
+ if (r == -EINVAL)
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
+ /* not a template */
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
+ return false;
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
+ if (r < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
+ /* oom, or some other failure. Just skip the warning. */
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
return true;
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
- }
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
/* an instance name points to a target that is just the template name */
|
|
Zbigniew Jędrzejewski-Szmek |
f4a676 |
if (streq(prefix, b))
|