1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 09:56:51 +03:00

execute: minor ExecOutput handling beautification (#6711)

Let's clean up the checking for the various ExecOutput values a bit,
let's use IN_SET everywhere, and the same concepts for all three bools
we pass to dprintf().
This commit is contained in:
Lennart Poettering 2017-09-01 02:04:27 +02:00 committed by Yu Watanabe
parent 78ca909980
commit aac8c0c382

View File

@ -243,6 +243,18 @@ static bool is_terminal_output(ExecOutput o) {
EXEC_OUTPUT_JOURNAL_AND_CONSOLE); EXEC_OUTPUT_JOURNAL_AND_CONSOLE);
} }
static bool is_syslog_output(ExecOutput o) {
return IN_SET(o,
EXEC_OUTPUT_SYSLOG,
EXEC_OUTPUT_SYSLOG_AND_CONSOLE);
}
static bool is_kmsg_output(ExecOutput o) {
return IN_SET(o,
EXEC_OUTPUT_KMSG,
EXEC_OUTPUT_KMSG_AND_CONSOLE);
}
static bool exec_context_needs_term(const ExecContext *c) { static bool exec_context_needs_term(const ExecContext *c) {
assert(c); assert(c);
@ -363,8 +375,8 @@ static int connect_logger_as(
params->flags & EXEC_PASS_LOG_UNIT ? unit->id : "", params->flags & EXEC_PASS_LOG_UNIT ? unit->id : "",
context->syslog_priority, context->syslog_priority,
!!context->syslog_level_prefix, !!context->syslog_level_prefix,
output == EXEC_OUTPUT_SYSLOG || output == EXEC_OUTPUT_SYSLOG_AND_CONSOLE, is_syslog_output(output),
output == EXEC_OUTPUT_KMSG || output == EXEC_OUTPUT_KMSG_AND_CONSOLE, is_kmsg_output(output),
is_terminal_output(output)); is_terminal_output(output));
if (fd == nfd) if (fd == nfd)