[Python-checkins] cpython: Issue #27776: dev_urandom(raise=0) now closes the file descriptor on error

victor.stinner python-checkins at python.org
Tue Aug 16 12:47:54 EDT 2016


https://hg.python.org/cpython/rev/ad141164c792
changeset:   102702:ad141164c792
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Aug 16 18:27:44 2016 +0200
summary:
  Issue #27776: dev_urandom(raise=0) now closes the file descriptor on error

files:
  Python/random.c |  1 +
  1 files changed, 1 insertions(+), 0 deletions(-)


diff --git a/Python/random.c b/Python/random.c
--- a/Python/random.c
+++ b/Python/random.c
@@ -331,6 +331,7 @@
 
             if (n <= 0) {
                 /* stop on error or if read(size) returned 0 */
+                close(fd);
                 return -1;
             }
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list