From: Lennart Poettering Date: Wed, 20 Mar 2019 20:20:00 +0000 (+0100) Subject: execute: split check if we might touch a tty out of exec_context_may_touch_console() X-Git-Tag: v242-rc1~96^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6c0ae739569038a0b65b756cae3248c889c22574;p=thirdparty%2Fsystemd.git execute: split check if we might touch a tty out of exec_context_may_touch_console() Some simple refactoring that'll come handy in a later commit. --- diff --git a/src/core/execute.c b/src/core/execute.c index ac741c2772c..5511c1aac5b 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -4160,14 +4160,20 @@ static bool tty_may_match_dev_console(const char *tty) { return path_equal(resolved, tty) || (streq(resolved, "tty0") && tty_is_vc(tty)); } -bool exec_context_may_touch_console(const ExecContext *ec) { +static bool exec_context_may_touch_tty(const ExecContext *ec) { + assert(ec); - return (ec->tty_reset || + return ec->tty_reset || ec->tty_vhangup || ec->tty_vt_disallocate || is_terminal_input(ec->std_input) || is_terminal_output(ec->std_output) || - is_terminal_output(ec->std_error)) && + is_terminal_output(ec->std_error); +} + +bool exec_context_may_touch_console(const ExecContext *ec) { + + return exec_context_may_touch_tty(ec) && tty_may_match_dev_console(exec_context_tty_path(ec)); }