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

This commit is contained in:
christos 2004-05-27 03:18:19 +00:00
parent 7010f41632
commit 9c9e94478a
2 changed files with 14 additions and 6 deletions

View File

@ -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 @@ main(int argc, char *argv[])
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");

View File

@ -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 @@ main(int argc, char *argv[])
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");