summaryrefslogtreecommitdiff
path: root/src/service.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-01-06 19:23:03 +0100
committerLennart Poettering <lennart@poettering.net>2012-01-06 19:23:03 +0100
commit73aa0c00df8b101bad4c3a038148a633df88610c (patch)
tree5feacf74894b4c99e07e29f46e72d6e3fb30a0e9 /src/service.c
parent6342c8eaaf18040db5f66c44ea3f83619bad7f42 (diff)
service: add dependencies on configured sockets
Diffstat (limited to 'src/service.c')
-rw-r--r--src/service.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/service.c b/src/service.c
index b97114c4be..c5a796623f 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1108,6 +1108,22 @@ static int service_add_default_dependencies(Service *s) {
return unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true);
}
+static int service_add_socket_dependencies(Service *s) {
+ Iterator i;
+ Unit *u;
+ int r;
+
+ /* Make sure we pull in all explicitly configured sockets */
+
+ SET_FOREACH(u, s->configured_sockets, i) {
+ r = unit_add_two_dependencies(UNIT(s), UNIT_AFTER, UNIT_REQUIRES, u, true);
+ if (r < 0)
+ return r;
+ }
+
+ return 0;
+}
+
static void service_fix_output(Service *s) {
assert(s);
@@ -1181,6 +1197,12 @@ static int service_load(Unit *u) {
if ((r = unit_add_two_dependencies_by_name(u, UNIT_AFTER, UNIT_REQUIRES, SPECIAL_DBUS_SOCKET, NULL, true)) < 0)
return r;
+ if (!set_isempty(s->configured_sockets)) {
+ r = service_add_socket_dependencies(s);
+ if (r < 0)
+ return r;
+ }
+
if (s->meta.default_dependencies)
if ((r = service_add_default_dependencies(s)) < 0)
return r;