py_getrandom(): getrandom() *can* return EINTR

See the latest version of getrandom() manual page:
http://man7.org/linux/man-pages/man2/getrandom.2.html#NOTES

    The behavior when a call to getrandom() that is blocked while reading from
    /dev/urandom is interrupted by a signal handler depends on the
    initialization state of the entropy buffer and on the request size, buflen.
    If the entropy is not yet initialized, then the call will fail with the
    EINTR error.  If the entropy pool has been initialized and the request size
    is large (buflen > 256), the call either succeeds, returning a partially
    filled buffer, or fails with the error EINTR.  If the entropy pool has been
    initialized and the request size is small (buflen <= 256), then getrandom()
    will not fail with EINTR.  Instead, it will return all of the bytes that
    have been requested.

Note: py_getrandom() calls getrandom() with flags=0.
This commit is contained in:
Victor Stinner 2015-07-30 10:13:52 +02:00
parent 707deb9df4
commit 61d5aab9b9
1 changed files with 0 additions and 1 deletions

View File

@ -142,7 +142,6 @@ py_getrandom(void *buffer, Py_ssize_t size, int raise)
} }
if (errno == EINTR) { if (errno == EINTR) {
/* Note: EINTR should not occur with flags=0 */
if (PyErr_CheckSignals()) { if (PyErr_CheckSignals()) {
if (!raise) if (!raise)
Py_FatalError("getrandom() interrupted by a signal"); Py_FatalError("getrandom() interrupted by a signal");