Here, we create a File from a raw fd. However, as this object is created on the stack, at the endo the function, the file will be dropped, and thus closed.
This means that on systems using a shared FD, the second call to getrandom will fail. This can be fixed by just storing a File instead of a RawFd in static memory.
Here, we create a
Filefrom a raw fd. However, as this object is created on the stack, at the endo the function, the file will be dropped, and thus closed.This means that on systems using a shared FD, the second call to
getrandomwill fail. This can be fixed by just storing aFileinstead of aRawFdin static memory.