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