diff options
author | Luca Boccassi <bluca@debian.org> | 2023-09-01 03:30:09 +0200 |
---|---|---|
committer | Luca Boccassi <bluca@debian.org> | 2023-09-10 23:57:19 +0200 |
commit | 0213162743fe5f6baafc4a1810a8968e50f2f181 (patch) | |
tree | 154ca725b38835781de047f85317631f01645afa /src/core/execute.c | |
parent | Merge pull request #29130 from poettering/unit-defaults (diff) | |
download | systemd-0213162743fe5f6baafc4a1810a8968e50f2f181.tar.xz systemd-0213162743fe5f6baafc4a1810a8968e50f2f181.zip |
core: use structured initialization in exec_context_init
Diffstat (limited to '')
-rw-r--r-- | src/core/execute.c | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/src/core/execute.c b/src/core/execute.c index ac71666bfa..a52df64d01 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -5236,29 +5236,34 @@ int exec_spawn(Unit *unit, void exec_context_init(ExecContext *c) { assert(c); - c->umask = 0022; - c->ioprio = IOPRIO_DEFAULT_CLASS_AND_PRIO; - c->cpu_sched_policy = SCHED_OTHER; - c->syslog_priority = LOG_DAEMON|LOG_INFO; - c->syslog_level_prefix = true; - c->ignore_sigpipe = true; - c->timer_slack_nsec = NSEC_INFINITY; - c->personality = PERSONALITY_INVALID; - for (ExecDirectoryType t = 0; t < _EXEC_DIRECTORY_TYPE_MAX; t++) - c->directories[t].mode = 0755; - c->timeout_clean_usec = USEC_INFINITY; - c->capability_bounding_set = CAP_MASK_UNSET; - assert_cc(NAMESPACE_FLAGS_INITIAL != NAMESPACE_FLAGS_ALL); - c->restrict_namespaces = NAMESPACE_FLAGS_INITIAL; - c->log_level_max = -1; + *c = (ExecContext) { + .umask = 0022, + .ioprio = IOPRIO_DEFAULT_CLASS_AND_PRIO, + .cpu_sched_policy = SCHED_OTHER, + .syslog_priority = LOG_DAEMON|LOG_INFO, + .syslog_level_prefix = true, + .ignore_sigpipe = true, + .timer_slack_nsec = NSEC_INFINITY, + .personality = PERSONALITY_INVALID, + .timeout_clean_usec = USEC_INFINITY, + .capability_bounding_set = CAP_MASK_UNSET, + .restrict_namespaces = NAMESPACE_FLAGS_INITIAL, + .log_level_max = -1, #if HAVE_SECCOMP - c->syscall_errno = SECCOMP_ERROR_NUMBER_KILL; + .syscall_errno = SECCOMP_ERROR_NUMBER_KILL, #endif - c->tty_rows = UINT_MAX; - c->tty_cols = UINT_MAX; + .tty_rows = UINT_MAX, + .tty_cols = UINT_MAX, + .private_mounts = -1, + .memory_ksm = -1, + }; + + for (ExecDirectoryType t = 0; t < _EXEC_DIRECTORY_TYPE_MAX; t++) + c->directories[t].mode = 0755; + numa_policy_reset(&c->numa_policy); - c->private_mounts = -1; - c->memory_ksm = -1; + + assert_cc(NAMESPACE_FLAGS_INITIAL != NAMESPACE_FLAGS_ALL); } void exec_context_done(ExecContext *c) { |