]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/vconsole/vconsole-setup.c
vconsole: search for usable source console (#6180)
authorMichal Soltys <soltys@ziu.info>
Mon, 3 Jul 2017 16:38:13 +0000 (18:38 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 3 Jul 2017 16:38:13 +0000 (12:38 -0400)
commit1142bed25ebd4822e16734911f374de3d6ccbf84
tree7a77a426d8225394c0742124eb278de4b86506d3
parentd4cbada2a95667c4d5d4310298bfcb446b1357b5
vconsole: search for usable source console (#6180)

When vconsole-setup is called without arguments, search for a usable
console instead of using /dev/tty0.

/dev/tty0 — pointing to the current active console — it not necessarily
usable and in such case vconsole-setup would exit with failure. In particular
when systemd-vconsole-setup.service was restarted from within an X
session, it always failed.

If the function searching for a usable source terminal fails, the first
encountered error is returned to the caller.

Closes #5367.

Additional changes:

- true/false functions with 'is_ prefix are renamed to functions with
  'verify_vc_' prefix and return 0 on success and negative error on
  failure
- O_NOCTTY flag is used when opening terminals
src/vconsole/vconsole-setup.c