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

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

 



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

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]