diff options
author | Patrick Mooney <pmooney@pfmooney.com> | 2016-10-25 16:48:33 +0000 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2016-11-17 07:12:22 -0800 |
commit | a192d1c0eb1d05a03ead3c7f898e864e4bf0399c (patch) | |
tree | 1223a54da8e434450eef671851357fb918a44189 /usr/src/lib/libc | |
parent | 4d4b495364f064247d3365e7dfa1da1b47cb3bd8 (diff) | |
download | illumos-joyent-a192d1c0eb1d05a03ead3c7f898e864e4bf0399c.tar.gz |
7506 epoll_create1 should toss EINVAL for invalid flags
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Diffstat (limited to 'usr/src/lib/libc')
-rw-r--r-- | usr/src/lib/libc/port/llib-lc | 1 | ||||
-rw-r--r-- | usr/src/lib/libc/port/sys/epoll.c | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/usr/src/lib/libc/port/llib-lc b/usr/src/lib/libc/port/llib-lc index b86f23280c..d33a1d39c2 100644 --- a/usr/src/lib/libc/port/llib-lc +++ b/usr/src/lib/libc/port/llib-lc @@ -99,6 +99,7 @@ #include <sys/cladm.h> #include <sys/corectl.h> #include <sys/dl.h> +#include <sys/epoll.h> #include <sys/exacct.h> #include <sys/fcntl.h> #include <sys/file.h> diff --git a/usr/src/lib/libc/port/sys/epoll.c b/usr/src/lib/libc/port/sys/epoll.c index 543856b2ec..34cb151135 100644 --- a/usr/src/lib/libc/port/sys/epoll.c +++ b/usr/src/lib/libc/port/sys/epoll.c @@ -95,8 +95,15 @@ epoll_create1(int flags) { int fd, oflags = O_RDWR; - if (flags & EPOLL_CLOEXEC) + if (flags & EPOLL_CLOEXEC) { oflags |= O_CLOEXEC; + flags ^= EPOLL_CLOEXEC; + } + /* Reject unrecognized flags */ + if (flags != 0) { + errno = EINVAL; + return (-1); + } if ((fd = open("/dev/poll", oflags)) == -1) return (-1); |