From 9b1fa2482e8efc4ffbb57643302dc68fff219153 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Sun, 29 Jan 2006 00:02:57 +0000 Subject: [PATCH] If the sysctl kern.pts.enable doesn't exist, check that /dev/ptmx is there, and if so, use the pts system. Suggested by: rwatson --- lib/libc/stdlib/grantpt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/libc/stdlib/grantpt.c b/lib/libc/stdlib/grantpt.c index 26b8017dc0fe..1f79211e4db0 100644 --- a/lib/libc/stdlib/grantpt.c +++ b/lib/libc/stdlib/grantpt.c @@ -100,8 +100,13 @@ __use_pts(void) len = sizeof(use_pts); error = sysctlbyname("kern.pts.enable", &use_pts, &len, NULL, 0); - if (error) - return (0); + if (error) { + struct stat sb; + + if (stat("/dev/ptmx", &sb) != 0) + return (0); + use_pts = 1; + } return (use_pts); }