summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorguenther <>2015-05-11 00:42:54 +0000
committerguenther <>2015-05-11 00:42:54 +0000
commitbe4ab66a3737ed365484a540057baea50378ba4a (patch)
tree1c9a8bc502e9cd3fa947cda84fcc8238a6187c59 /src
parentcc6ef0c9e34bc998c3a45235b90541cd1deb534f (diff)
downloadopenbsd-be4ab66a3737ed365484a540057baea50378ba4a.tar.gz
openbsd-be4ab66a3737ed365484a540057baea50378ba4a.tar.bz2
openbsd-be4ab66a3737ed365484a540057baea50378ba4a.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 'src')
-rw-r--r--src/lib/libc/stdlib/posix_pty.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libc/stdlib/posix_pty.c b/src/lib/libc/stdlib/posix_pty.c
index a2025ddbb6..72b5d527cc 100644
--- a/src/lib/libc/stdlib/posix_pty.c
+++ b/src/lib/libc/stdlib/posix_pty.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: posix_pty.c,v 1.1 2012/12/03 20:08:33 millert Exp $ */ 1/* $OpenBSD: posix_pty.c,v 1.2 2015/05/11 00:42:54 guenther Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2012 Todd C. Miller <Todd.Miller@courtesan.com> 4 * Copyright (c) 2012 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -35,7 +35,8 @@ posix_openpt(int oflag)
35 int fd, mfd = -1; 35 int fd, mfd = -1;
36 36
37 /* User must specify O_RDWR in oflag. */ 37 /* User must specify O_RDWR in oflag. */
38 if (!(oflag & O_RDWR)) { 38 if ((oflag & O_ACCMODE) != O_RDWR ||
39 (oflag & ~(O_ACCMODE | O_NOCTTY)) != 0) {
39 errno = EINVAL; 40 errno = EINVAL;
40 return -1; 41 return -1;
41 } 42 }