Skip to content
Snippets Groups Projects
Commit 68a3b6db authored by Nadav Har'El's avatar Nadav Har'El Committed by Avi Kivity
Browse files

libc: fix size check in select()


select() previously returned EINVAL only when nfds > FD_SETSIZE+1. The
right test is nfds > FD_SETSIZE, i.e., for nfds = FD_SETSIZE+1 this is also
an error.

Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
parent 828ec291
No related branches found
No related tags found
No related merge requests found
...@@ -31,7 +31,7 @@ int select (int nfds, ...@@ -31,7 +31,7 @@ int select (int nfds,
select_d("select(nfds=%d, readfds=0x%lx, writefds=0x%lx, exceptfds=0x%lx, timeout=0x%lx)", select_d("select(nfds=%d, readfds=0x%lx, writefds=0x%lx, exceptfds=0x%lx, timeout=0x%lx)",
nfds, readfds, writefds, exceptfds, timeout); nfds, readfds, writefds, exceptfds, timeout);
if ((nfds < 0) || (nfds > FD_SETSIZE+1)) { if ((nfds < 0) || (nfds > FD_SETSIZE)) {
select_d("select() failed 1"); select_d("select() failed 1");
errno = EINVAL; errno = EINVAL;
return -1; return -1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment