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.
This commit is contained in:
Laine Stump 2010-01-11 10:05:38 +01:00 committed by Daniel Veillard
parent 0418fa2e72
commit 28024f2311

View 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. */