summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-08-16 16:27:44 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-08-16 16:27:44 (GMT)
commit3ee933f1c34755bb210e23942d22649a0c38bd23 (patch)
treec4b69c7ac3a36bdf948bfcf1a21d8d5c62a25944 /Python
parent6974cf2c2719a6bf1bc72b60077de6681c09a44f (diff)
downloadcpython-3ee933f1c34755bb210e23942d22649a0c38bd23.zip
cpython-3ee933f1c34755bb210e23942d22649a0c38bd23.tar.gz
cpython-3ee933f1c34755bb210e23942d22649a0c38bd23.tar.bz2
Issue #27776: dev_urandom(raise=0) now closes the file descriptor on error
Diffstat (limited to 'Python')
-rw-r--r--Python/random.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Python/random.c b/Python/random.c
index 511070a..6fdce64 100644
--- a/Python/random.c
+++ b/Python/random.c
@@ -331,6 +331,7 @@ dev_urandom(char *buffer, Py_ssize_t size, int raise)
if (n <= 0) {
/* stop on error or if read(size) returned 0 */
+ close(fd);
return -1;
}