You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.3 KiB

From 33cca921994d30abfb03ce0f681c6fc58f5c0703 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 24 Apr 2015 17:28:06 +0200
Subject: [PATCH] unit: don't add automatic dependencies on device units if
they aren't supported
http://lists.freedesktop.org/archives/systemd-devel/2015-April/031187.html
(cherry picked from commit 47bc12e1ba35d38edda737dae232088d6d3ae688)
Cherry-picked from: c20cdaa
Resolves: #1222517
---
src/core/unit.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/core/unit.c b/src/core/unit.c
index 565455bd63..b9e1f13eaf 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2830,14 +2830,18 @@ int unit_add_node_link(Unit *u, const char *what, bool wants) {
assert(u);
- if (!what)
- return 0;
-
/* Adds in links to the device node that this unit is based on */
+ if (isempty(what))
+ return 0;
if (!is_device_path(what))
return 0;
+ /* When device units aren't supported (such as in a
+ * container), don't create dependencies on them. */
+ if (unit_vtable[UNIT_DEVICE]->supported && !unit_vtable[UNIT_DEVICE]->supported(u->manager))
+ return 0;
+
e = unit_name_from_path(what, ".device");
if (!e)
return -ENOMEM;