cpython: fb7628e8dfef (original) (raw)

Mercurial > cpython

changeset 100945:fb7628e8dfef 3.5

Fix os.urandom() on Solaris 11.3 Issue #26735: Fix os.urandom() on Solaris 11.3 and newer when reading more than 1,024 bytes: call getrandom() multiple times with a limit of 1024 bytes per call. [#26735]

Victor Stinner victor.stinner@gmail.com
date Tue, 12 Apr 2016 22:28:49 +0200
parents f8398dba48fb
children f6a5d26a157d
files Misc/NEWS Python/random.c
diffstat 2 files changed, 16 insertions(+), 5 deletions(-)[+] [-] Misc/NEWS 4 Python/random.c 17

line wrap: on

line diff

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -102,6 +102,10 @@ Core and Builtins Library ------- +- Issue #26735: Fix :func:os.urandom on Solaris 11.3 and newer when reading

--- a/Python/random.c +++ b/Python/random.c @@ -131,16 +131,23 @@ py_getrandom(void *buffer, Py_ssize_t si return 0; while (0 < size) { +#ifdef sun

+#else

+#endif + errno = 0; - #ifdef HAVE_GETRANDOM if (raise) { Py_BEGIN_ALLOW_THREADS

#else /* On Linux, use the syscall() function because the GNU libc doesn't @@ -148,11 +155,11 @@ py_getrandom(void *buffer, Py_ssize_t si * https://sourceware.org/bugzilla/show_bug.cgi?id=17252 */ if (raise) { Py_BEGIN_ALLOW_THREADS

#endif