From 6126f7a53c57485a9a29ddd772765695f23c92e6 Mon Sep 17 00:00:00 2001 From: Petr Uzel Date: Thu, 3 May 2012 21:02:01 +0200 Subject: 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 --- include/randutils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/randutils.h') diff --git a/include/randutils.h b/include/randutils.h index dec5e355a..d5d00f469 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 -- cgit v1.2.3-55-g7522