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
This commit is contained in:
emaste 2014-07-02 20:40:59 +00:00
parent 06ba451499
commit 25f9584271
2 changed files with 10 additions and 8 deletions

View File

@ -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 *

View File

@ -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);
}
/*