diff options
author | Petr Uzel | 2012-05-03 21:02:01 +0200 |
---|---|---|
committer | Karel Zak | 2012-05-04 15:14:24 +0200 |
commit | 6126f7a53c57485a9a29ddd772765695f23c92e6 (patch) | |
tree | b4f93a19a5459e69a7fa43b773590f42eb927b43 /fdisk | |
parent | uuidd: introduce uuidd_cxt to pass arguments to server loop (diff) | |
download | kernel-qcow2-util-linux-6126f7a53c57485a9a29ddd772765695f23c92e6.tar.gz kernel-qcow2-util-linux-6126f7a53c57485a9a29ddd772765695f23c92e6.tar.xz kernel-qcow2-util-linux-6126f7a53c57485a9a29ddd772765695f23c92e6.zip |
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 'fdisk')
-rw-r--r-- | fdisk/fdiskdoslabel.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fdisk/fdiskdoslabel.c b/fdisk/fdiskdoslabel.c index 6a9a0445d..c6e4198dd 100644 --- a/fdisk/fdiskdoslabel.c +++ b/fdisk/fdiskdoslabel.c @@ -182,7 +182,7 @@ void create_doslabel(void) unsigned int id; /* random disk signature */ - random_get_bytes(&id, sizeof(id)); + random_get_bytes(&id, sizeof(id), -1); fprintf(stderr, _("Building a new DOS disklabel with disk identifier 0x%08x.\n"), id); |