diff --git a/regress/lib/libc/pty/ptmx/ptmx.c b/regress/lib/libc/pty/ptmx/ptmx.c index 13a810d4c00c..2940cf1d75f0 100644 --- a/regress/lib/libc/pty/ptmx/ptmx.c +++ b/regress/lib/libc/pty/ptmx/ptmx.c @@ -1,4 +1,4 @@ -/* $NetBSD: ptmx.c,v 1.3 2004/05/27 03:18:19 christos Exp $ */ +/* $NetBSD: ptmx.c,v 1.4 2004/11/11 15:57:47 christos Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: ptmx.c,v 1.3 2004/05/27 03:18:19 christos Exp $"); +__RCSID("$NetBSD: ptmx.c,v 1.4 2004/11/11 15:57:47 christos Exp $"); #include #include @@ -45,6 +45,14 @@ __RCSID("$NetBSD: ptmx.c,v 1.3 2004/05/27 03:18:19 christos Exp $"); #include #include +/* + * On NetBSD /dev/ptyp0 == /dev/pts/0 so we can check for major + * and minor device numbers. This check is non-portable. This + * check is now disabled because we might not have /dev/ptyp0 + * at all. + */ +#undef PTY_DEVNO_CHECK + int main(int argc, char *argv[]) { @@ -62,15 +70,20 @@ main(int argc, char *argv[]) if (fstat(fdm, &stm) == -1) err(1, "fstat master"); +#ifdef PTY_DEVNO_CHECK if (stat("/dev/ptyp0", &sts) == -1) - err(1, "stat example"); + err(1, "stat `%s'", /dev/ptyp0); if (major(stm.st_rdev) != major(sts.st_rdev)) errx(1, "bad master major number %d", major(stm.st_rdev)); +#endif if (grantpt(fdm) == -1) err(1, "grantpt"); + if (unlockpt(fdm) == -1) + err(1, "unlockpt"); + if ((pty = ptsname(fdm)) == NULL) err(1, "ptsname"); @@ -80,8 +93,10 @@ main(int argc, char *argv[]) if (fstat(fds, &sts) == -1) err(1, "fstat slave"); +#ifdef PTY_DEVNO_CHECK if (minor(stm.st_rdev) != minor(sts.st_rdev)) errx(1, "bad slave minor number %d", major(stm.st_rdev)); +#endif if (sts.st_uid != getuid()) errx(1, "bad slave uid %lu != %lu", (unsigned long)stm.st_uid,