diff options
author | Petr Uzel <petr.uzel@suse.cz> | 2012-05-03 21:02:01 +0200 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2012-05-04 15:14:24 +0200 |
commit | 6126f7a53c57485a9a29ddd772765695f23c92e6 (patch) | |
tree | b4f93a19a5459e69a7fa43b773590f42eb927b43 /include/randutils.h | |
parent | 881a0f6b286f034c99214c17c81d58b447d5908c (diff) | |
download | util-linux-6126f7a53c57485a9a29ddd772765695f23c92e6.tar.gz |
libuuid: avoid double open and leaking descriptor
We are opening /dev/urandom twice in uuid_generate(): first to check if
the file is available and then later __uuid_generate_random() again to
actually get the random data. Moreover, descriptor from the first open
is leaking.
Fix by passign the descriptor down the stack and reusing it there.
References: http://marc.info/?l=util-linux-ng&m=133406051131131&w=2
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Diffstat (limited to 'include/randutils.h')
-rw-r--r-- | include/randutils.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/randutils.h b/include/randutils.h index dec5e355..d5d00f46 100644 --- a/include/randutils.h +++ b/include/randutils.h @@ -7,6 +7,6 @@ #endif extern int random_get_fd(void); -extern void random_get_bytes(void *buf, size_t nbytes); +extern void random_get_bytes(void *buf, size_t nbytes, int fd); #endif |