naccyde / rpms / systemd

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