summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Le Vaillant <glv@posteo.net>2021-07-31 10:14:36 +0200
committerGuillaume Le Vaillant <glv@posteo.net>2021-07-31 10:14:36 +0200
commitdd08d82af03c39e607fdbde75fcd948e89d0ee1d (patch)
treea7c6e209464e180e27f04e71b892b8207fab0b11
parent6cc4da8554558ee2e89ea38802bbf6d83100d4ea (diff)
Check if /dev/urandom stream is open before using it
-rw-r--r--src/prng/os-prng.lisp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/prng/os-prng.lisp b/src/prng/os-prng.lisp
index 1f245ab..fb36bbb 100644
--- a/src/prng/os-prng.lisp
+++ b/src/prng/os-prng.lisp
@@ -15,7 +15,7 @@
#+unix
(let* ((seq (make-array num-bytes :element-type '(unsigned-byte 8)))
(n (bt:with-lock-held (*os-prng-stream-lock*)
- (unless *os-prng-stream*
+ (unless (and *os-prng-stream* (open-stream-p *os-prng-stream*))
(setf *os-prng-stream* (open #P"/dev/urandom"
#+ccl :sharing #+ccl :external
:element-type '(unsigned-byte 8))))