diff options
author | Larry Hastings <larry@hastings.org> | 2016-06-26 19:53:18 -0700 |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2016-06-26 19:53:18 -0700 |
commit | 1b329e791ae3a3a2989f05e8c2019b67b4e1a7df (patch) | |
tree | 91e137c00f35f21a2c17b385f9746492b8347558 /Python/random.c | |
parent | 9bb200545970bb920c83124658cb89c7d295166d (diff) | |
parent | 1e957d145fa1fc05ca1fbb9f135ab162c939ae14 (diff) | |
download | cpython-git-1b329e791ae3a3a2989f05e8c2019b67b4e1a7df.tar.gz |
Merge.
Diffstat (limited to 'Python/random.c')
-rw-r--r-- | Python/random.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/random.c b/Python/random.c index 07dacfe188..3119872abd 100644 --- a/Python/random.c +++ b/Python/random.c @@ -132,7 +132,7 @@ py_getrandom(void *buffer, Py_ssize_t size, int raise) * see https://bugs.python.org/issue26839. To avoid this, use the * GRND_NONBLOCK flag. */ const int flags = GRND_NONBLOCK; - int n; + long n; if (!getrandom_works) return 0; @@ -143,7 +143,7 @@ py_getrandom(void *buffer, Py_ssize_t size, int raise) to 1024 bytes */ n = Py_MIN(size, 1024); #else - n = size; + n = Py_MIN(size, LONG_MAX); #endif errno = 0; @@ -251,7 +251,7 @@ dev_urandom_noraise(unsigned char *buffer, Py_ssize_t size) break; } buffer += n; - size -= (Py_ssize_t)n; + size -= n; } close(fd); } |