From: Victor Stinner Date: Tue, 16 Aug 2016 16:27:44 +0000 (+0200) Subject: Issue #27776: dev_urandom(raise=0) now closes the file descriptor on error X-Git-Tag: v3.6.0b1~704 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3ee933f1c34755bb210e23942d22649a0c38bd23;p=python Issue #27776: dev_urandom(raise=0) now closes the file descriptor on error --- diff --git a/Python/random.c b/Python/random.c index 511070add0..6fdce64bca 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; }