diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-07-22 00:23:36 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-07-22 00:23:36 -0400 |
commit | d40e344f7b311980dfe3c165d8cbecfe04c12bd2 (patch) | |
tree | a681ebc8249790bd507714361e3db464a6ea07be | |
parent | 63d447e2a3bb7faf69e0befb123e6ffff0ce47ea (diff) | |
download | musl-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.c | 2 |
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); |