<div dir="ltr">random_device::random_device(const string&) initializes one if it's members with the result of a call to open.<div><br></div><div>However, it assumes that open can only validly return a file descriptor greater than zero.</div>
<div><br></div><div>This results in random_device believing that it didn't successfully open the device causing it to throw in it's constructor, this ends up leaking a file descriptor.</div><div><br></div><div>The fix is simple, don't error on file descriptors which are zero.</div>
</div>