Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Jul 2014 20:40:59 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r268175 - in head/usr.sbin: kbdcontrol vidcontrol
Message-ID:  <201407022040.s62Kex4c077419@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Wed Jul  2 20:40:59 2014
New Revision: 268175
URL: http://svnweb.freebsd.org/changeset/base/268175

Log:
  Fix vt(4) detection in kbdcontrol and vidcontrol
  
  As sc(4) and vt(4) coexist and are both enabled in GENERIC, the existence
  of a vt(4) sysctl is not sufficient to determine that vt(4) is in use.
  
  Reported by:	Trond Endrestøl

Modified:
  head/usr.sbin/kbdcontrol/kbdcontrol.c
  head/usr.sbin/vidcontrol/vidcontrol.c

Modified: head/usr.sbin/kbdcontrol/kbdcontrol.c
==============================================================================
--- head/usr.sbin/kbdcontrol/kbdcontrol.c	Wed Jul  2 19:53:51 2014	(r268174)
+++ head/usr.sbin/kbdcontrol/kbdcontrol.c	Wed Jul  2 20:40:59 2014	(r268175)
@@ -146,11 +146,12 @@ static void	usage(void) __dead2;
 static int
 is_vt4(void)
 {
+	char vty_name[4] = "";
+	size_t len = sizeof(vty_name);
 
-	if (sysctlbyname("kern.vt.deadtimer", NULL, NULL, NULL, 0) == 0)
-		return (1);
-
-	return (0);
+	if (sysctlbyname("kern.vty", vty_name, &len, NULL, 0) != 0)
+		return (0);
+	return (strcmp(vty_name, "vt") == 0);
 }
 
 static char *

Modified: head/usr.sbin/vidcontrol/vidcontrol.c
==============================================================================
--- head/usr.sbin/vidcontrol/vidcontrol.c	Wed Jul  2 19:53:51 2014	(r268174)
+++ head/usr.sbin/vidcontrol/vidcontrol.c	Wed Jul  2 20:40:59 2014	(r268175)
@@ -216,11 +216,12 @@ usage(void)
 static int
 is_vt4(void)
 {
+	char vty_name[4] = "";
+	size_t len = sizeof(vty_name);
 
-	if (sysctlbyname("kern.vt.deadtimer", NULL, NULL, NULL, 0) == 0)
-		return (1);
-
-	return (0);
+	if (sysctlbyname("kern.vty", vty_name, &len, NULL, 0) != 0)
+		return (0);
+	return (strcmp(vty_name, "vt") == 0);
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407022040.s62Kex4c077419>