diff options
author | Petr Uzel | 2012-05-06 21:55:53 +0200 |
---|---|---|
committer | Karel Zak | 2012-05-10 11:43:49 +0200 |
commit | c544aa2c25095e6a4d4fca761eb15c46435086fc (patch) | |
tree | c188e1c320037328b009cf9cb6fa252fdeb1a2ad /fdisk/fdiskdoslabel.c | |
parent | lslocks: fix bracket indentation (diff) | |
download | kernel-qcow2-util-linux-c544aa2c25095e6a4d4fca761eb15c46435086fc.tar.gz kernel-qcow2-util-linux-c544aa2c25095e6a4d4fca761eb15c46435086fc.tar.xz kernel-qcow2-util-linux-c544aa2c25095e6a4d4fca761eb15c46435086fc.zip |
libuuid: avoid double open and leaking fd (reworked)
This reverts commit 6126f7a53c57485a9a29ddd772765695f23c92e6
and fixes the double open and leaking descriptor in a different way,
that is by using newly introduced function 'have_random_source()'
to check whether good random source is available while deciding
which uuid type to generate (random/time).
This is better than calling random_get_fd() twice, passing the file
descriptor down the stack and reusing it in next call to
random_get_fd().
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Diffstat (limited to 'fdisk/fdiskdoslabel.c')
-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 a1916fc57..34bcde6e7 100644 --- a/fdisk/fdiskdoslabel.c +++ b/fdisk/fdiskdoslabel.c @@ -224,7 +224,7 @@ void create_doslabel(void) unsigned int id; /* random disk signature */ - random_get_bytes(&id, sizeof(id), -1); + random_get_bytes(&id, sizeof(id)); fprintf(stderr, _("Building a new DOS disklabel with disk identifier 0x%08x.\n"), id); |