diff options
author | 2015-05-11 00:42:54 +0000 | |
---|---|---|
committer | 2015-05-11 00:42:54 +0000 | |
commit | dc519336cc6495b5a61e8b6564dc5dc717ce145a (patch) | |
tree | 7566cb6538c290b5609f5f24676148488439fbf2 /lib/libc/stdlib/posix_pty.c | |
parent | Set POLLHUP even if no valid events were specified as per POSIX. (diff) | |
download | wireguard-openbsd-dc519336cc6495b5a61e8b6564dc5dc717ce145a.tar.xz wireguard-openbsd-dc519336cc6495b5a61e8b6564dc5dc717ce145a.zip |
When checking flags that will be passed to open(), test the O_ACCMODE portion
separately to avoid false negatives.
ok miod@ millert@
Diffstat (limited to 'lib/libc/stdlib/posix_pty.c')
-rw-r--r-- | lib/libc/stdlib/posix_pty.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/stdlib/posix_pty.c b/lib/libc/stdlib/posix_pty.c index a2025ddbb61..72b5d527cc5 100644 --- a/lib/libc/stdlib/posix_pty.c +++ b/lib/libc/stdlib/posix_pty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: posix_pty.c,v 1.1 2012/12/03 20:08:33 millert Exp $ */ +/* $OpenBSD: posix_pty.c,v 1.2 2015/05/11 00:42:54 guenther Exp $ */ /* * Copyright (c) 2012 Todd C. Miller <Todd.Miller@courtesan.com> @@ -35,7 +35,8 @@ posix_openpt(int oflag) int fd, mfd = -1; /* User must specify O_RDWR in oflag. */ - if (!(oflag & O_RDWR)) { + if ((oflag & O_ACCMODE) != O_RDWR || + (oflag & ~(O_ACCMODE | O_NOCTTY)) != 0) { errno = EINVAL; return -1; } |