From d40e344f7b311980dfe3c165d8cbecfe04c12bd2 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Fri, 22 Jul 2011 00:23:36 -0400 Subject: incorrect check for open failure in openpty function -1, not 0, indicates failure --- src/misc/openpty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/misc') diff --git a/src/misc/openpty.c b/src/misc/openpty.c index 0b4eb221..10202473 100644 --- a/src/misc/openpty.c +++ b/src/misc/openpty.c @@ -12,7 +12,7 @@ int openpty(int *m, int *s, char *name, const struct termios *tio, const struct char buf[20]; *m = open("/dev/ptmx", O_RDWR|O_NOCTTY); - if (!*m) return -1; + if (*m < 0) return -1; if (ioctl(*m, TIOCSPTLCK, &n) || ioctl (*m, TIOCGPTN, &n)) { close(*m); -- cgit v1.2.1