summaryrefslogtreecommitdiffstats
path: root/src/core/service.c
diff options
context:
space:
mode:
authorMike Yuan <me@yhndnzj.com>2024-03-23 10:27:46 +0100
committerMike Yuan <me@yhndnzj.com>2024-03-23 18:08:40 +0100
commit23908d841081eb46c3032c595970456288854fe1 (patch)
tree146ec9457fb4c4ec6a87ad93308a47ba7c149fc1 /src/core/service.c
parentcore/socket: validate service unit load state before continuing (diff)
downloadsystemd-23908d841081eb46c3032c595970456288854fe1.tar.xz
systemd-23908d841081eb46c3032c595970456288854fe1.zip
core/socket: remove duplicate unit_add_two_dependencies
Diffstat (limited to 'src/core/service.c')
-rw-r--r--src/core/service.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/service.c b/src/core/service.c
index 38fb07d594..cc6b6e6961 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -4722,6 +4722,7 @@ int service_set_socket_fd(
assert(s);
assert(fd >= 0);
+ assert(sock);
/* This is called by the socket code when instantiating a new service for a stream socket and the socket needs
* to be configured. We take ownership of the passed fd on success. */
@@ -4753,9 +4754,10 @@ int service_set_socket_fd(
return r;
}
- r = unit_add_two_dependencies(UNIT(sock), UNIT_BEFORE, UNIT_TRIGGERS, UNIT(s), false, UNIT_DEPENDENCY_IMPLICIT);
+ r = unit_add_two_dependencies(UNIT(s), UNIT_AFTER, UNIT_TRIGGERED_BY, UNIT(sock), false, UNIT_DEPENDENCY_IMPLICIT);
if (r < 0)
- return r;
+ return log_unit_debug_errno(UNIT(s), r,
+ "Failed to add After=/TriggeredBy= dependencies on socket unit: %m");
s->socket_fd = fd;
s->socket_peer = socket_peer_ref(peer);