diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-01-03 20:33:28 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-01-03 21:08:57 +0100 |
commit | 4cfc6dbe52e4ff867750ce0d64f09d42c0ea6c27 (patch) | |
tree | bbaee2674a163ef71e216054ed97e37f25423327 /src | |
parent | 4de856120f252e7aa19c923c10fbf23310d623aa (diff) |
socket: only add dependency on kmsg socket to socket units which have any kind of exec program specified
Diffstat (limited to 'src')
-rw-r--r-- | src/socket.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/socket.c b/src/socket.c index bbfc842c70..1f5e067337 100644 --- a/src/socket.c +++ b/src/socket.c @@ -323,6 +323,17 @@ static int socket_add_default_dependencies(Socket *s) { return unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true); } +static bool socket_has_exec(Socket *s) { + unsigned i; + assert(s); + + for (i = 0; i < _SOCKET_EXEC_COMMAND_MAX; i++) + if (s->exec_command[i]) + return true; + + return false; +} + static int socket_load(Unit *u) { Socket *s = SOCKET(u); int r; @@ -352,8 +363,9 @@ static int socket_load(Unit *u) { if ((r = socket_add_device_link(s)) < 0) return r; - if ((r = unit_add_exec_dependencies(u, &s->exec_context)) < 0) - return r; + if (socket_has_exec(s)) + if ((r = unit_add_exec_dependencies(u, &s->exec_context)) < 0) + return r; if ((r = unit_add_default_cgroups(u)) < 0) return r; |