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

Hans de Goede hdegoede at redhat.com
Thu Jul 7 08:55:04 UTC 2016


/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 at linux.intel.com>
Suggested-by: Julien Cristau <jcristau at debian.org>
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 hw/xfree86/os-support/linux/lnx_init.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
index d3a53ea..dbf497c 100644
--- a/hw/xfree86/os-support/linux/lnx_init.c
+++ b/hw/xfree86/os-support/linux/lnx_init.c
@@ -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;
-- 
2.7.4



More information about the xorg-devel mailing list