Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/regress/lib/libc/pty Don't cause errors when the devices are...



details:   https://anonhg.NetBSD.org/src/rev/f712c1a01fed
branches:  trunk
changeset: 566993:f712c1a01fed
user:      christos <christos%NetBSD.org@localhost>
date:      Thu May 27 03:18:19 2004 +0000

description:
Don't cause errors when the devices are not configured.

diffstat:

 regress/lib/libc/pty/ptm/ptm.c   |  10 +++++++---
 regress/lib/libc/pty/ptmx/ptmx.c |  10 +++++++---
 2 files changed, 14 insertions(+), 6 deletions(-)

diffs (73 lines):

diff -r 3d895901fb30 -r f712c1a01fed regress/lib/libc/pty/ptm/ptm.c
--- a/regress/lib/libc/pty/ptm/ptm.c    Thu May 27 03:14:26 2004 +0000
+++ b/regress/lib/libc/pty/ptm/ptm.c    Thu May 27 03:18:19 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptm.c,v 1.1 2004/05/26 01:24:03 christos Exp $ */
+/*     $NetBSD: ptm.c,v 1.2 2004/05/27 03:18:19 christos Exp $ */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -36,12 +36,13 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: ptm.c,v 1.1 2004/05/26 01:24:03 christos Exp $");
+__RCSID("$NetBSD: ptm.c,v 1.2 2004/05/27 03:18:19 christos Exp $");
 
 #include <stdlib.h>
 #include <unistd.h>
 #include <grp.h>
 #include <fcntl.h>
+#include <errno.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 
@@ -54,8 +55,11 @@
        int fdm, fds;
        struct group *gp;
 
-       if ((fdm = open("/dev/ptm", O_RDWR)) == -1)
+       if ((fdm = open("/dev/ptm", O_RDWR)) == -1) {
+               if (errno == ENOENT || errno == ENODEV)
+                       return 0;
                err(1, "open multiplexor");
+       }
 
        if (fstat(fdm, &stm) == -1)
                err(1, "fstat multiplexor");
diff -r 3d895901fb30 -r f712c1a01fed regress/lib/libc/pty/ptmx/ptmx.c
--- a/regress/lib/libc/pty/ptmx/ptmx.c  Thu May 27 03:14:26 2004 +0000
+++ b/regress/lib/libc/pty/ptmx/ptmx.c  Thu May 27 03:18:19 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ptmx.c,v 1.2 2004/05/26 01:14:56 christos Exp $        */
+/*     $NetBSD: ptmx.c,v 1.3 2004/05/27 03:18:19 christos Exp $        */
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -36,11 +36,12 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: ptmx.c,v 1.2 2004/05/26 01:14:56 christos Exp $");
+__RCSID("$NetBSD: ptmx.c,v 1.3 2004/05/27 03:18:19 christos Exp $");
 
 #include <stdlib.h>
 #include <unistd.h>
 #include <grp.h>
+#include <errno.h>
 #include <fcntl.h>
 #include <sys/stat.h>
 
@@ -52,8 +53,11 @@
        int fdm, fds;
        struct group *gp;
 
-       if ((fdm = posix_openpt(O_RDWR|O_NOCTTY)) == -1)
+       if ((fdm = posix_openpt(O_RDWR|O_NOCTTY)) == -1) {
+               if (errno == ENOENT || errno == ENODEV)
+                       return 0;
                err(1, "open master");
+       }
 
        if (fstat(fdm, &stm) == -1)
                err(1, "fstat master");



Home | Main Index | Thread Index | Old Index