summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-07-22 00:23:36 -0400
committerRich Felker <dalias@aerifal.cx>2011-07-22 00:23:36 -0400
commitd40e344f7b311980dfe3c165d8cbecfe04c12bd2 (patch)
treea681ebc8249790bd507714361e3db464a6ea07be
parent63d447e2a3bb7faf69e0befb123e6ffff0ce47ea (diff)
downloadmusl-d40e344f7b311980dfe3c165d8cbecfe04c12bd2.tar.gz
musl-d40e344f7b311980dfe3c165d8cbecfe04c12bd2.tar.bz2
musl-d40e344f7b311980dfe3c165d8cbecfe04c12bd2.tar.xz
musl-d40e344f7b311980dfe3c165d8cbecfe04c12bd2.zip
incorrect check for open failure in openpty function
-1, not 0, indicates failure
-rw-r--r--src/misc/openpty.c2
1 files changed, 1 insertions, 1 deletions
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);