diff options
author | Oran Avraham <252748+oranav@users.noreply.github.com> | 2018-12-05 22:36:03 +0200 |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2018-12-05 21:36:03 +0100 |
commit | 7f52415a6d4841d77d3b7853e83b25a22e0048dc (patch) | |
tree | 6eef274e7577448b78fb638442f53f6826041192 /Modules/selectmodule.c | |
parent | 67a93b3a0b3814e97ef9d077b21325fc8ce351b2 (diff) | |
download | cpython-git-7f52415a6d4841d77d3b7853e83b25a22e0048dc.tar.gz |
bpo-35310: Clear select() lists before returning upon EINTR (GH-10877)
select() calls are retried on EINTR (per PEP 475). However, if a
timeout was provided and the deadline has passed after running the
signal handlers, rlist, wlist and xlist should be cleared since select(2)
left them unmodified.
Diffstat (limited to 'Modules/selectmodule.c')
-rw-r--r-- | Modules/selectmodule.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index 5a6b13466c..fe69cd58dc 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -335,6 +335,10 @@ select_select_impl(PyObject *module, PyObject *rlist, PyObject *wlist, if (tvp) { timeout = deadline - _PyTime_GetMonotonicClock(); if (timeout < 0) { + /* bpo-35310: lists were unmodified -- clear them explicitly */ + FD_ZERO(&ifdset); + FD_ZERO(&ofdset); + FD_ZERO(&efdset); n = 0; break; } |