projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
63d447e
)
incorrect check for open failure in openpty function
author
Rich Felker
<dalias@aerifal.cx>
Fri, 22 Jul 2011 04:23:36 +0000
(
00:23
-0400)
committer
Rich Felker
<dalias@aerifal.cx>
Fri, 22 Jul 2011 04:23:36 +0000
(
00:23
-0400)
-1, not 0, indicates failure
src/misc/openpty.c
patch
|
blob
|
history
diff --git
a/src/misc/openpty.c
b/src/misc/openpty.c
index 0b4eb221497601fd4fcc56a9f0905f12a638f95d..102024732d09296596eb9b857ed316fb3ffc0685 100644
(file)
--- 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);