Re: [PATCH 3/3] libuuid: use randutils

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 10, 2012 at 01:31:50PM +0200, Karel Zak wrote:
> On Thu, Apr 05, 2012 at 11:52:10PM +0200, Davidlohr Bueso wrote:
> >  libuuid/src/Makefile.am |    3 +-
> >  libuuid/src/gen_uuid.c  |   99 ++--------------------------------------------
> >  2 files changed, 7 insertions(+), 95 deletions(-)
> 
>  Applied, thanks.
> 
> > @@ -703,7 +614,7 @@ void uuid_generate_random(uuid_t out)
> >   */
> >  void uuid_generate(uuid_t out)
> >  {
> > -	if (get_random_fd() >= 0)
> > +	if (random_get_fd() >= 0)
> >  		uuid_generate_random(out);
> 
> This sucks:
> 
>  - because we call random_get_fd() in __uuid_generate_random again:
> 
>    $ strace -e open ./misc-utils/uuidgen
>    open("/dev/urandom", O_RDONLY)          = 3
>    open("/dev/urandom", O_RDONLY)          = 4
> 
>    it would be better to add 'fd' argument to __uuid_generate_random(),
>    use it in uuid_generate() and reuse the file descriptor if >= 0. 
> 
>    We use __uuid_generate_random in the library and in uuidd, so we
>    don't have to care about API there.
> 
>  - it's file descriptor leak in shared library...
> 
>  Volunteers? ;-)

If nobody steps out, I can include this in my uuidd systemd-ization
series (which I'll hopefully finish this week).

Petr

--
Petr Uzel
IRC: ptr_uzl @ freenode
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux