libc: Ensure /dev/random is opened with O_CLOEXEC on init
This commit is contained in:
parent
d93a4062a2
commit
8ed0ff1381
@ -15,7 +15,8 @@ static void initialize_random()
|
|||||||
{
|
{
|
||||||
unsigned int seed = 3735928559U;
|
unsigned int seed = 3735928559U;
|
||||||
|
|
||||||
FILE* fp = fopen("/dev/random", "rw");
|
int fd = open("/dev/random", O_RDONLY | O_CLOEXEC); // If we somehow fail to close this file, close it on exec.
|
||||||
|
FILE* fp = fdopen(fd, "r");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user