core: introduce exec_params_clear()
Follow-up for 1ad6e8b302
.
Fixes #10677.
This commit is contained in:
parent
0ccc48b5b8
commit
b9c04eafb8
|
@ -5112,6 +5112,13 @@ void exec_runtime_vacuum(Manager *m) {
|
|||
}
|
||||
}
|
||||
|
||||
void exec_params_clear(ExecParameters *p) {
|
||||
if (!p)
|
||||
return;
|
||||
|
||||
strv_free(p->environment);
|
||||
}
|
||||
|
||||
static const char* const exec_input_table[_EXEC_INPUT_MAX] = {
|
||||
[EXEC_INPUT_NULL] = "null",
|
||||
[EXEC_INPUT_TTY] = "tty",
|
||||
|
|
|
@ -383,6 +383,8 @@ int exec_runtime_deserialize_compat(Unit *u, const char *key, const char *value,
|
|||
void exec_runtime_deserialize_one(Manager *m, const char *value, FDSet *fds);
|
||||
void exec_runtime_vacuum(Manager *m);
|
||||
|
||||
void exec_params_clear(ExecParameters *p);
|
||||
|
||||
const char* exec_output_to_string(ExecOutput i) _const_;
|
||||
ExecOutput exec_output_from_string(const char *s) _pure_;
|
||||
|
||||
|
|
|
@ -747,7 +747,7 @@ static void mount_dump(Unit *u, FILE *f, const char *prefix) {
|
|||
|
||||
static int mount_spawn(Mount *m, ExecCommand *c, pid_t *_pid) {
|
||||
|
||||
ExecParameters exec_params = {
|
||||
_cleanup_(exec_params_clear) ExecParameters exec_params = {
|
||||
.flags = EXEC_APPLY_SANDBOXING|EXEC_APPLY_CHROOT|EXEC_APPLY_TTY_STDIN,
|
||||
.stdin_fd = -1,
|
||||
.stdout_fd = -1,
|
||||
|
|
|
@ -1399,7 +1399,7 @@ static int service_spawn(
|
|||
ExecFlags flags,
|
||||
pid_t *_pid) {
|
||||
|
||||
ExecParameters exec_params = {
|
||||
_cleanup_(exec_params_clear) ExecParameters exec_params = {
|
||||
.flags = flags,
|
||||
.stdin_fd = -1,
|
||||
.stdout_fd = -1,
|
||||
|
@ -1538,7 +1538,7 @@ static int service_spawn(
|
|||
SET_FLAG(exec_params.flags, EXEC_NSS_BYPASS_BUS,
|
||||
MANAGER_IS_SYSTEM(UNIT(s)->manager) && unit_has_name(UNIT(s), SPECIAL_DBUS_SERVICE));
|
||||
|
||||
exec_params.environment = final_env;
|
||||
strv_free_and_replace(exec_params.environment, final_env);
|
||||
exec_params.fds = fds;
|
||||
exec_params.fd_names = fd_names;
|
||||
exec_params.n_socket_fds = n_socket_fds;
|
||||
|
|
|
@ -1860,7 +1860,7 @@ static int socket_coldplug(Unit *u) {
|
|||
|
||||
static int socket_spawn(Socket *s, ExecCommand *c, pid_t *_pid) {
|
||||
|
||||
ExecParameters exec_params = {
|
||||
_cleanup_(exec_params_clear) ExecParameters exec_params = {
|
||||
.flags = EXEC_APPLY_SANDBOXING|EXEC_APPLY_CHROOT|EXEC_APPLY_TTY_STDIN,
|
||||
.stdin_fd = -1,
|
||||
.stdout_fd = -1,
|
||||
|
|
|
@ -596,7 +596,7 @@ static void swap_dump(Unit *u, FILE *f, const char *prefix) {
|
|||
|
||||
static int swap_spawn(Swap *s, ExecCommand *c, pid_t *_pid) {
|
||||
|
||||
ExecParameters exec_params = {
|
||||
_cleanup_(exec_params_clear) ExecParameters exec_params = {
|
||||
.flags = EXEC_APPLY_SANDBOXING|EXEC_APPLY_CHROOT|EXEC_APPLY_TTY_STDIN,
|
||||
.stdin_fd = -1,
|
||||
.stdout_fd = -1,
|
||||
|
|
Loading…
Reference in New Issue