[PATCH v2] Add getrandom implementation [BZ #17252]

Florian Weimer fweimer@redhat.com
Thu Sep 8 09:53:00 GMT 2016


On 06/30/2016 11:32 AM, Rical Jasan wrote:
>> > +#ifndef _SYS_RANDOM_H
>> > +#define _SYS_RANDOM_H
> Isn't there a preferred way of doing this that defines _SYS_RANDOM_H to
> 1?  I seem to remember a wiki page that talked about protecting against
> typos.

This might defeat the header guard optimization.  Existing practice 
varies, some headers use 1, some don't.

 > How strict is the coding style about unnecessary parentheses?

I prefer adding braces to if statements if they are nested and some have 
else branches.

 > Really though, reading the code, it made sense to me.

Thanks.  I'm attaching a version with your comments (not rebased to 2.25 
though).  We may need this code again if we ever implement a 
arc4random-style interface.

(I think the consensus for getrandom is to add only a thin wrapper 
around the system call, if we are going to add it at all.)

Florian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getrandom-with-fallback.patch
Type: text/x-patch
Size: 41635 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20160908/1e59e9ab/attachment.bin>


More information about the Libc-alpha mailing list