0 <= fd < FD_SETSIZE must hold, or else undefined behavior in
FD_SET().
* Known contributors to this file:
* Sasha Mikheev
* Steve McClure, 1998
* Known contributors to this file:
* Sasha Mikheev
* Steve McClure, 1998
- * Markus Armbruster, 2005-2010
+ * Markus Armbruster, 2005-2011
* Ron Koenderink, 2007-2009
*/
* Ron Koenderink, 2007-2009
*/
empth_t *ctx;
int res = 0;
empth_t *ctx;
int res = 0;
+ if (CANT_HAPPEN(fd < 0 || fd >= FD_SETSIZE)) {
+ errno = EBADF;
+ return -1;
+ }
+
ef_make_stale();
pthread_mutex_unlock(&mtx_ctxsw);
empth_status("select on %d for %d", fd, flags);
ef_make_stale();
pthread_mutex_unlock(&mtx_ctxsw);
empth_status("select on %d for %d", fd, flags);