core/execute: reformat exec_context_named_iofds() for legibility
This commit is contained in:
parent
9e615117da
commit
56fbd56143
|
@ -3096,7 +3096,7 @@ const char* exec_context_fdname(const ExecContext *c, int fd_index) {
|
||||||
|
|
||||||
int exec_context_named_iofds(Unit *unit, const ExecContext *c, const ExecParameters *p, int named_iofds[3]) {
|
int exec_context_named_iofds(Unit *unit, const ExecContext *c, const ExecParameters *p, int named_iofds[3]) {
|
||||||
unsigned i, targets;
|
unsigned i, targets;
|
||||||
const char *stdio_fdname[3];
|
const char* stdio_fdname[3];
|
||||||
|
|
||||||
assert(c);
|
assert(c);
|
||||||
assert(p);
|
assert(p);
|
||||||
|
@ -3109,18 +3109,32 @@ int exec_context_named_iofds(Unit *unit, const ExecContext *c, const ExecParamet
|
||||||
stdio_fdname[i] = exec_context_fdname(c, i);
|
stdio_fdname[i] = exec_context_fdname(c, i);
|
||||||
|
|
||||||
for (i = 0; i < p->n_fds && targets > 0; i++)
|
for (i = 0; i < p->n_fds && targets > 0; i++)
|
||||||
if (named_iofds[STDIN_FILENO] < 0 && c->std_input == EXEC_INPUT_NAMED_FD && stdio_fdname[STDIN_FILENO] && streq(p->fd_names[i], stdio_fdname[STDIN_FILENO])) {
|
if (named_iofds[STDIN_FILENO] < 0 &&
|
||||||
|
c->std_input == EXEC_INPUT_NAMED_FD &&
|
||||||
|
stdio_fdname[STDIN_FILENO] &&
|
||||||
|
streq(p->fd_names[i], stdio_fdname[STDIN_FILENO])) {
|
||||||
|
|
||||||
named_iofds[STDIN_FILENO] = p->fds[i];
|
named_iofds[STDIN_FILENO] = p->fds[i];
|
||||||
targets--;
|
targets--;
|
||||||
} else if (named_iofds[STDOUT_FILENO] < 0 && c->std_output == EXEC_OUTPUT_NAMED_FD && stdio_fdname[STDOUT_FILENO] && streq(p->fd_names[i], stdio_fdname[STDOUT_FILENO])) {
|
|
||||||
|
} else if (named_iofds[STDOUT_FILENO] < 0 &&
|
||||||
|
c->std_output == EXEC_OUTPUT_NAMED_FD &&
|
||||||
|
stdio_fdname[STDOUT_FILENO] &&
|
||||||
|
streq(p->fd_names[i], stdio_fdname[STDOUT_FILENO])) {
|
||||||
|
|
||||||
named_iofds[STDOUT_FILENO] = p->fds[i];
|
named_iofds[STDOUT_FILENO] = p->fds[i];
|
||||||
targets--;
|
targets--;
|
||||||
} else if (named_iofds[STDERR_FILENO] < 0 && c->std_error == EXEC_OUTPUT_NAMED_FD && stdio_fdname[STDERR_FILENO] && streq(p->fd_names[i], stdio_fdname[STDERR_FILENO])) {
|
|
||||||
|
} else if (named_iofds[STDERR_FILENO] < 0 &&
|
||||||
|
c->std_error == EXEC_OUTPUT_NAMED_FD &&
|
||||||
|
stdio_fdname[STDERR_FILENO] &&
|
||||||
|
streq(p->fd_names[i], stdio_fdname[STDERR_FILENO])) {
|
||||||
|
|
||||||
named_iofds[STDERR_FILENO] = p->fds[i];
|
named_iofds[STDERR_FILENO] = p->fds[i];
|
||||||
targets--;
|
targets--;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (targets == 0 ? 0 : -ENOENT);
|
return targets == 0 ? 0 : -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
int exec_context_load_environment(Unit *unit, const ExecContext *c, char ***l) {
|
int exec_context_load_environment(Unit *unit, const ExecContext *c, char ***l) {
|
||||||
|
|
Loading…
Reference in a new issue