diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2012-10-12 17:29:16 +0200 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2012-10-12 17:29:16 +0200 |
commit | abf03bc54032beeff95b1b8634cc005137e11f32 (patch) | |
tree | a65891599ad4b74ba10fe20e26dd074f5442f2f8 | |
parent | b4848e229dbf65b6941a04403605703b500c46c8 (diff) |
check if the file descriptor can be stored in the select() file descriptor set (r1781 from 0.8)
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd-0.7@1782 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r-- | common/tio.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/common/tio.c b/common/tio.c index ce5ab61..ff75f64 100644 --- a/common/tio.c +++ b/common/tio.c @@ -184,6 +184,11 @@ static int tio_select(TFILE *fp, int readfd, const struct timeval *deadline) while (1) { /* prepare our filedescriptorset */ + if (fp->fd>=FD_SETSIZE) + { + errno=EBADFD; + return -1; + } FD_ZERO(&fdset); FD_SET(fp->fd,&fdset); /* figure out the time we need to wait */ @@ -397,6 +402,11 @@ static int tio_flush_nonblock(TFILE *fp) fd_set fdset; int rv; /* prepare our filedescriptorset */ + if (fp->fd>=FD_SETSIZE) + { + errno=EBADFD; + return -1; + } FD_ZERO(&fdset); FD_SET(fp->fd,&fdset); /* set the timeout to 0 to poll */ |