summaryrefslogtreecommitdiff
path: root/hurd
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2013-02-19 22:35:46 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2013-02-19 22:35:46 +0100
commit3256ef22989313dd7e6c13af9d73a248d990b6cc (patch)
tree91c714bb9c46aafde2948d1e94ad59df5b16fcc1 /hurd
parenta03a4c8aecbf7e9b9bf20ae2a399f8a4515c83ac (diff)
on EBADF error, also make timeout 0 so we return immediately the error
Diffstat (limited to 'hurd')
-rw-r--r--hurd/hurdselect.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/hurd/hurdselect.c b/hurd/hurdselect.c
index 78980c4998..e2757568fc 100644
--- a/hurd/hurdselect.c
+++ b/hurd/hurdselect.c
@@ -161,6 +161,25 @@ _hurd_select (int nfds,
/* Bogus descriptor, make it EBADF already. */
d[i].error = EBADF;
d[i].type = SELECT_ERROR;
+
+ /* And set timeout to 0. */
+ {
+ struct timeval now;
+ err = __gettimeofday(&now, NULL);
+ if (err)
+ {
+ err = errno;
+ while (i-- > 0)
+ if (d[i].type & ~SELECT_ERROR != 0)
+ _hurd_port_free (&d[i].cell->port, &d[i].ulink,
+ d[i].io_port);
+ errno = err;
+ return -1;
+ }
+ td[0].sec = now.tv_sec;
+ td[0].nsec = now.tv_usec * 1000;
+ reply_msgid = IO_SELECT_TIMEOUT_REPLY_MSGID;
+ }
}
__mutex_unlock (&_hurd_dtable_lock);