Open /dev/urandom with O_CLOEXEC.

Let's avoid bleeding file descriptors into our clients' children,
shall we?

XXX pullup
This commit is contained in:
riastradh 2020-02-15 23:19:37 +00:00
parent 57d4369975
commit 86465dbe5a

View File

@ -479,7 +479,7 @@ static int get_random_device(size_t n)
return rd->fd;
/* open the random device ... */
if ((rd->fd = open(random_device_paths[n], O_RDONLY)) == -1)
if ((rd->fd = open(random_device_paths[n], O_RDONLY|O_CLOEXEC)) == -1)
return rd->fd;
/* ... and cache its relevant stat(2) data */