[PATCH] [libc++] random_device fails if open returns zero
david.majnemer at gmail.com
Mon Jun 2 19:29:40 PDT 2014
Committed in r210060.
On Mon, Jun 2, 2014 at 3:54 PM, Marshall Clow <mclow.lists at gmail.com> wrote:
> On May 28, 2014, at 10:49 PM, David Majnemer <david.majnemer at gmail.com>
> > random_device::random_device(const string&) initializes one if it's
> members with the result of a call to open.
> > However, it assumes that open can only validly return a file descriptor
> greater than zero.
> > 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.
> > The fix is simple, don't error on file descriptors which are zero.
> LGTM - please commit.
> [ open returns the smallest “non-negative integer” available ]
> — Marshall
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-commits