From 3ee933f1c34755bb210e23942d22649a0c38bd23 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 16 Aug 2016 18:27:44 +0200 Subject: Issue #27776: dev_urandom(raise=0) now closes the file descriptor on error --- Python/random.c | 1 + 1 file changed, 1 insertion(+) (limited to 'Python/random.c') diff --git a/Python/random.c b/Python/random.c index 511070add0a..6fdce64bca3 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; } -- cgit v1.2.3