]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Fix UUID random generator to use /dev/random
authorLaine Stump <laine@laine.org>
Mon, 11 Jan 2010 09:05:38 +0000 (10:05 +0100)
committerDaniel Veillard <veillard@redhat.com>
Mon, 11 Jan 2010 09:06:54 +0000 (10:06 +0100)
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

index 002a64d3be2f8778d25decc86ed10ac78841504c..20ed1189fb7d1f7474ae888380164931c5550963 100644 (file)
@@ -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.  */