1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-06 00:58:29 +03:00

Merge pull request #31959 from YHNdnzj/execute-pass-fds

core/execute: check if EXEC_PASS_FDS is set if got exec_params.fds
This commit is contained in:
Yu Watanabe 2024-03-27 02:37:23 +09:00 committed by GitHub
commit 18640f8211
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -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);

View File

@ -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);
}