Hello,

Thanks Guillem for the additional review :)

Guillem Jover, le jeu. 31 oct. 2019 13:31:58 +0100, a ecrit:
> On Tue, 2019-10-29 at 23:28:26 -0500, Andrew Eggenberger wrote:
> > +  if (flags & GRND_RANDOM){
> > +    random_source = "/dev/random";
> > +  }
> > +
> > +  fp = open(random_source, O_RDONLY);
> 
> Shouldn't this be opened with O_CLOEXEC, otherwise children created
> by other threads might leak file descriptors. Although I don't see
> this being consistently done in glibc, not sure why?

Indeed.  I guess it's not always done only due to historical reasons.

> > +  amount_read = read(fp, buffer, length);
> 
> What about partial reads?

That is fine, the getrandom interface explicitly allows partial reads.

Samuel

Reply via email to