From 0917c36f35f6cba100a91fcdc256bfafde649412 Mon Sep 17 00:00:00 2001 From: Hannes Mehnert Date: Fri, 6 Dec 2024 11:38:29 +0100 Subject: [PATCH] close the /dev/urandom file descriptor at exit --- rng/unix/urandom.ml | 1 + 1 file changed, 1 insertion(+) diff --git a/rng/unix/urandom.ml b/rng/unix/urandom.ml index 4e32b7cf..36f750bd 100644 --- a/rng/unix/urandom.ml +++ b/rng/unix/urandom.ml @@ -7,6 +7,7 @@ let create ?time:_ () = let ic = In_channel.open_bin "/dev/urandom" and mutex = Mutex.create () in + at_exit (fun () -> In_channel.close ic); (ic, mutex) let generate_into ~g:(ic, m) buf ~off len =