linux: Do not try to open /dev/vc/0, fix error msg when /dev/tty0 open fails

/dev/vc/0 is a devfs thing which is long dead, so stop trying to open
/dev/vc/0, besides being a (small) code cleanup this will also fix the
"parse_vt_settings: Cannot open /dev/tty0 (%s)\n" error message to
display the actual error, rather then the -ENOENT from also trying
/dev/vc/0.

BugLink: https://patchwork.freedesktop.org/patch/8768/
Reported-by: Chad Versace <chad.versace@linux.intel.com>
Suggested-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Chad Versace <chad.versace@intel.com>
This commit is contained in:
Hans De Goede 2016-07-07 10:55:04 +02:00 committed by Adam Jackson
parent ce24f3aa58
commit 033888e776

View File

@ -93,7 +93,6 @@ linux_parse_vt_settings(int may_fail)
struct vt_stat vts;
struct stat st;
MessageType from = X_PROBED;
const char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL };
/* Only do this once */
static int vt_settings_parsed = 0;
@ -108,14 +107,7 @@ linux_parse_vt_settings(int may_fail)
from = X_CMDLINE;
}
else {
i = 0;
while (tty0[i] != NULL) {
if ((fd = open(tty0[i], O_WRONLY, 0)) >= 0)
break;
i++;
}
fd = open("/dev/tty0", O_WRONLY, 0);
if (fd < 0) {
if (may_fail)
return 0;