diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-03-24 19:45:16 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-03-31 14:36:12 -0400 |
commit | e62d8c3944745ed276e6d4f33153009860e5cfc5 (patch) | |
tree | e7f70ed3b80581017b6340723ab6f1d6b9c30bad /src/core/execute.c | |
parent | 3c8bed4ee061f96acb4d70a591a9849bddd2a659 (diff) |
Modernization
Use _cleanup_ and wrap lines to ~80 chars and such.
Diffstat (limited to 'src/core/execute.c')
-rw-r--r-- | src/core/execute.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/core/execute.c b/src/core/execute.c index 85edca17e3..f7353579e9 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -1215,8 +1215,12 @@ int exec_spawn(ExecCommand *command, zero(param); param.sched_priority = context->cpu_sched_priority; - if (sched_setscheduler(0, context->cpu_sched_policy | - (context->cpu_sched_reset_on_fork ? SCHED_RESET_ON_FORK : 0), ¶m) < 0) { + r = sched_setscheduler(0, + context->cpu_sched_policy | + (context->cpu_sched_reset_on_fork ? + SCHED_RESET_ON_FORK : 0), + ¶m); + if (r < 0) { err = -errno; r = EXIT_SETSCHEDULER; goto fail_child; @@ -1437,7 +1441,8 @@ int exec_spawn(ExecCommand *command, } } - if (!(our_env = new0(char*, 7))) { + our_env = new0(char*, 7); + if (!our_env) { err = -ENOMEM; r = EXIT_MEMORY; goto fail_child; @@ -1477,20 +1482,21 @@ int exec_spawn(ExecCommand *command, assert(n_env <= 7); - if (!(final_env = strv_env_merge( - 5, - environment, - our_env, - context->environment, - files_env, - pam_env, - NULL))) { + final_env = strv_env_merge(5, + environment, + our_env, + context->environment, + files_env, + pam_env, + NULL); + if (!final_env) { err = -ENOMEM; r = EXIT_MEMORY; goto fail_child; } - if (!(final_argv = replace_env_argv(argv, final_env))) { + final_argv = replace_env_argv(argv, final_env); + if (!final_argv) { err = -ENOMEM; r = EXIT_MEMORY; goto fail_child; @@ -1519,10 +1525,10 @@ int exec_spawn(ExecCommand *command, } log_struct_unit(LOG_DEBUG, - unit_id, - "MESSAGE=Forked %s as %lu", - command->path, (unsigned long) pid, - NULL); + unit_id, + "MESSAGE=Forked %s as %lu", + command->path, (unsigned long) pid, + NULL); /* We add the new process to the cgroup both in the child (so * that we can be sure that no user code is ever executed |