From 28024f2311462d7f836e9f90aea805d1861b2abe Mon Sep 17 00:00:00 2001 From: Laine Stump Date: Mon, 11 Jan 2010 10:05:38 +0100 Subject: [PATCH] Fix UUID random generator to use /dev/random Only use pseudo-random generator for uuid if using /dev/random fails. * src/util/uuid.c: 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util/uuid.c b/src/util/uuid.c index 002a64d3be..20ed1189fb 100644 --- a/src/util/uuid.c +++ b/src/util/uuid.c @@ -104,9 +104,10 @@ 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. */