From aac8c0c3829e51dda7049c56dde2963e3c8642cb Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 1 Sep 2017 02:04:27 +0200 Subject: [PATCH] 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(). --- src/core/execute.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/core/execute.c b/src/core/execute.c index 0cbaf9a00ba..e4bf237f1e0 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -243,6 +243,18 @@ static bool is_terminal_output(ExecOutput o) { 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) { assert(c); @@ -363,8 +375,8 @@ static int connect_logger_as( params->flags & EXEC_PASS_LOG_UNIT ? unit->id : "", context->syslog_priority, !!context->syslog_level_prefix, - output == EXEC_OUTPUT_SYSLOG || output == EXEC_OUTPUT_SYSLOG_AND_CONSOLE, - output == EXEC_OUTPUT_KMSG || output == EXEC_OUTPUT_KMSG_AND_CONSOLE, + is_syslog_output(output), + is_kmsg_output(output), is_terminal_output(output)); if (fd == nfd)