diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2013-02-28 01:35:47 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2013-02-28 02:23:53 +0100 |
commit | 3a1286b66883ef2cf577b29364e4b5fd43a295c8 (patch) | |
tree | 7fa0398c6fa98d4d86074d49eebd2492b91da00b /src | |
parent | 21baf21ae526d0180177cf4a26ce82d45b6103e2 (diff) |
core/execute: add internal is_terminal_output()
Similar to already existing is_terminal_input().
Note that the only current user (connect_logger_as) is never called
for EXEC_OUTPUT_TTY, so it won't mind whether we accept it.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/execute.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/core/execute.c b/src/core/execute.c index b28962a3c3..1f62635196 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -165,6 +165,14 @@ void exec_context_tty_reset(const ExecContext *context) { vt_disallocate(context->tty_path); } +static bool is_terminal_output(ExecOutput o) { + return + o == EXEC_OUTPUT_TTY || + o == EXEC_OUTPUT_SYSLOG_AND_CONSOLE || + o == EXEC_OUTPUT_KMSG_AND_CONSOLE || + o == EXEC_OUTPUT_JOURNAL_AND_CONSOLE; +} + static int open_null_as(int flags, int nfd) { int fd, r; @@ -224,7 +232,7 @@ static int connect_logger_as(const ExecContext *context, ExecOutput output, cons !!context->syslog_level_prefix, output == EXEC_OUTPUT_SYSLOG || output == EXEC_OUTPUT_SYSLOG_AND_CONSOLE, output == EXEC_OUTPUT_KMSG || output == EXEC_OUTPUT_KMSG_AND_CONSOLE, - output == EXEC_OUTPUT_SYSLOG_AND_CONSOLE || output == EXEC_OUTPUT_KMSG_AND_CONSOLE || output == EXEC_OUTPUT_JOURNAL_AND_CONSOLE); + is_terminal_output(output)); if (fd != nfd) { r = dup2(fd, nfd) < 0 ? -errno : nfd; |