From: Luca Boccassi Date: Fri, 1 Sep 2023 01:30:09 +0000 (+0100) Subject: core: use structured initialization in exec_context_init X-Git-Tag: v255-rc1~531^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0213162743fe5f6baafc4a1810a8968e50f2f181;p=thirdparty%2Fsystemd.git core: use structured initialization in exec_context_init --- diff --git a/src/core/execute.c b/src/core/execute.c index ac71666bfa6..a52df64d010 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) {