diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-03-26 18:37:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-26 18:37:23 +0100 |
commit | 18640f821144f449012231ce0e3e373c8f7fe9e5 (patch) | |
tree | 1248547127d02d40db59e8d4887e9eac2fac7c0f /src | |
parent | Merge pull request #31960 from YHNdnzj/capsule-followup (diff) | |
parent | core/execute: check if EXEC_PASS_FDS is set if got exec_params.fds (diff) | |
download | systemd-18640f821144f449012231ce0e3e373c8f7fe9e5.tar.xz systemd-18640f821144f449012231ce0e3e373c8f7fe9e5.zip |
Merge pull request #31959 from YHNdnzj/execute-pass-fds
core/execute: check if EXEC_PASS_FDS is set if got exec_params.fds
Diffstat (limited to 'src')
-rw-r--r-- | src/core/execute.c | 3 | ||||
-rw-r--r-- | src/core/service.c | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/core/execute.c b/src/core/execute.c index 864e3d4921..41b3b3f2b5 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -374,7 +374,8 @@ int exec_spawn(Unit *unit, assert(command); assert(context); assert(params); - assert(params->fds || (params->n_socket_fds + params->n_storage_fds <= 0)); + assert(!params->fds || FLAGS_SET(params->flags, EXEC_PASS_FDS)); + assert(params->fds || (params->n_socket_fds + params->n_storage_fds == 0)); assert(!params->files_env); /* We fill this field, ensure it comes NULL-initialized to us */ assert(ret); diff --git a/src/core/service.c b/src/core/service.c index 953cb2934a..be38ec73d8 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -1409,10 +1409,9 @@ static int service_collect_fds( Socket *sock; int cn_fds; - if (u->type != UNIT_SOCKET) - continue; - sock = SOCKET(u); + if (!sock) + continue; cn_fds = socket_collect_fds(sock, &cfds); if (cn_fds < 0) @@ -1682,6 +1681,8 @@ static int service_spawn_internal( exec_params.open_files = s->open_files; + exec_params.flags |= EXEC_PASS_FDS; + log_unit_debug(UNIT(s), "Passing %zu fds to service", exec_params.n_socket_fds + exec_params.n_storage_fds); } |