[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]