diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-08-20 20:10:18 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-08-20 20:10:18 +0200 |
commit | 32516160f64fab46249de1aa9832d5e8b0dceb4d (patch) | |
tree | 43eb0a52bcf9099187d478d4dd720b231f31fafd /hurd/hurdselect.c | |
parent | e827fc3efb03d684766be5d1a9961dd87d925a90 (diff) | |
parent | 105611191fe003c18764798b9ed12ec1491a8968 (diff) |
Merge commit 'refs/top-bases/t/poll_errors_fixes' into t/poll_errors_fixes
Diffstat (limited to 'hurd/hurdselect.c')
-rw-r--r-- | hurd/hurdselect.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/hurd/hurdselect.c b/hurd/hurdselect.c index 070ac1a0cc..cc697564ff 100644 --- a/hurd/hurdselect.c +++ b/hurd/hurdselect.c @@ -1,5 +1,5 @@ /* Guts of both `select' and `poll' for Hurd. - Copyright (C) 1991-2014 Free Software Foundation, Inc. + Copyright (C) 1991-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -74,7 +74,7 @@ _hurd_select (int nfds, assert (sizeof (union typeword) == sizeof (mach_msg_type_t)); assert (sizeof (uint32_t) == sizeof (mach_msg_type_t)); - if (nfds < 0 || nfds > FD_SETSIZE) + if (nfds < 0 || (pollfds == NULL && nfds > FD_SETSIZE)) { errno = EINVAL; return -1; @@ -394,7 +394,7 @@ _hurd_select (int nfds, } while ((msgerr = __mach_msg (&msg.head, - MACH_RCV_MSG | options, + MACH_RCV_MSG | MACH_RCV_INTERRUPT | options, 0, sizeof msg, portset, to, MACH_PORT_NULL)) == MACH_MSG_SUCCESS) { @@ -479,13 +479,9 @@ _hurd_select (int nfds, } } - if (err == MACH_RCV_TIMED_OUT) - /* This is the normal value for ERR. We might have timed out and - read no messages. Otherwise, after receiving the first message, - we poll for more messages. We receive with a timeout of 0 to - effect a poll, so ERR is MACH_RCV_TIMED_OUT when the poll finds no - message waiting. */ - err = 0; + if (msgerr == MACH_RCV_INTERRUPTED) + /* Interruption on our side (e.g. signal reception). */ + err = EINTR; if (ready) /* At least one descriptor is known to be ready now, so we will |