libuuid: use randutils
PATCH 3/3 libuuid: use randutils
From: Davidlohr Bueso <[email protected]>
--- libuuid/src/Makefile.am | 3 +- libuuid/src/gen_uuid.c | 99 ++-------------------------------------------- 2 files changed, 7 insertions(+), 95 deletions(-)
libuuid/src/Makefile.am +2 -1
@@ -25,7 +25,8 @@ libuuid_la_SOURCES = \ uuidd.h \ uuidP.h \ uuid_time.c \ - $(uuidinc_HEADERS) + $(uuidinc_HEADERS) \ + $(top_srcdir)/lib/randutils.c libuuid_la_DEPENDENCIES = uuid.sym
libuuid/src/gen_uuid.c +5 -94
141 lines not on this page · raw message
Signature · 1 line
1.7.4.1
Quoted 3 lines · Davidlohr Bueso
libuuid/src/Makefile.am | 3 +- libuuid/src/gen_uuid.c | 99 ++-------------------------------------------- 2 files changed, 7 insertions(+), 95 deletions(-)
Applied, thanks.
libuuid/src/gen_uuid.c void uuid_generate_random(uuid_t out) · line 618
Quoted 7 lines
libuuid/src/gen_uuid.c +1
-1@@ -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? ;-)
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com
Quoted 26 lines · Karel Zak
Quoted 3 lines · Davidlohr Bueso
libuuid/src/Makefile.am | 3 +- libuuid/src/gen_uuid.c | 99 ++-------------------------------------------- 2 files changed, 7 insertions(+), 95 deletions(-)Applied, thanks.
libuuid/src/gen_uuid.c void uuid_generate_random(uuid_t out) · line 618
Quoted 7 lines
libuuid/src/gen_uuid.c +1
-1@@ -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_randomagain:$ strace -e open ./misc-utils/uuidgen open("/dev/urandom", O_RDONLY) = 3 open("/dev/urandom", O_RDONLY) = 4it would be better to add 'fd' argument to
__uuid_generate_random(), use it inuuid_generate()and reuse the file descriptor if >= 0.
Quoted 6 lines
We use
__uuid_generate_randomin 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
Quoted 26 lines · Karel Zak
Quoted 3 lines · Davidlohr Bueso
libuuid/src/Makefile.am | 3 +- libuuid/src/gen_uuid.c | 99 ++-------------------------------------------- 2 files changed, 7 insertions(+), 95 deletions(-)Applied, thanks.
libuuid/src/gen_uuid.c void uuid_generate_random(uuid_t out) · line 618
Quoted 7 lines
libuuid/src/gen_uuid.c +1
-1@@ -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_randomagain:$ strace -e open ./misc-utils/uuidgen open("/dev/urandom", O_RDONLY) = 3 open("/dev/urandom", O_RDONLY) = 4it would be better to add 'fd' argument to
__uuid_generate_random(), use it inuuid_generate()and reuse the file descriptor if >= 0.
Quoted 6 lines
We use
__uuid_generate_randomin the library and in uuidd, so we don't have to care about API there.- it's file descriptor leak in shared library...
Volunteers? ;-)
Patch addressing this is included in the uuidd series I sent shortly before. But please check the note about it in the series cover letter.
Thanks,
Petr
Signature · 2 lines
Petr Uzel IRC: ptr_uzl @ freenode