[libvirt] [PATCH] Only use pseudo-random generator for uuid if using /dev/random fails.

The original code. would only print the warning message if using /dev/random failed, but would still go ahead and call virUUIDGeneratePseudoRandomBytes in all cases anyway. --- src/util/uuid.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/uuid.c b/src/util/uuid.c index 002a64d..846581c 100644 --- a/src/util/uuid.c +++ b/src/util/uuid.c @@ -104,9 +104,9 @@ virUUIDGenerate(unsigned char *uuid) VIR_WARN(_("Falling back to pseudorandom UUID," " failed to generate random bytes: %s"), virStrerror(err, ebuf, sizeof ebuf)); + err = virUUIDGeneratePseudoRandomBytes(uuid, VIR_UUID_BUFLEN); } - - return virUUIDGeneratePseudoRandomBytes(uuid, VIR_UUID_BUFLEN); + return err; } /* Convert C from hexadecimal character to integer. */ -- 1.6.6

On Fri, Jan 08, 2010 at 12:51:44PM -0500, Laine Stump wrote:
The original code. would only print the warning message if using /dev/random failed, but would still go ahead and call virUUIDGeneratePseudoRandomBytes in all cases anyway. --- src/util/uuid.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/util/uuid.c b/src/util/uuid.c index 002a64d..846581c 100644 --- a/src/util/uuid.c +++ b/src/util/uuid.c @@ -104,9 +104,9 @@ virUUIDGenerate(unsigned char *uuid) VIR_WARN(_("Falling back to pseudorandom UUID," " failed to generate random bytes: %s"), virStrerror(err, ebuf, sizeof ebuf)); + err = virUUIDGeneratePseudoRandomBytes(uuid, VIR_UUID_BUFLEN); } - - return virUUIDGeneratePseudoRandomBytes(uuid, VIR_UUID_BUFLEN); + return err; }
/* Convert C from hexadecimal character to integer. */
Ah, right, ACK, pushed, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (2)
-
Daniel Veillard
-
Laine Stump