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