On Wed, Oct 02, 2013 at 01:00:43AM +1000, Jonathan Liu wrote:
> +/* hack: use the ext2 uuid library to generate a reasonably random (hopefully
> + * with /dev/random) number. Unfortunately, we can only use 4 bytes of it.
> + * We make sure to avoid returning zero which may be interpreted as no FAT
> + * serial number or no MBR signature.
> + */
> +static inline uint32_t
> +generate_random_uint32 (void)
> +{
> + union {
> + uuid_t uuid;
> + uint32_t i;
> + } uu32;
> +
> + do {
> + uuid_generate (uu32.uuid);
> + } while (uu32.i == 0);I'd like to see a limit on this while with an error if it gets a zero more than 3 times in a row. -- Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
pgpNubLe0sf8P.pgp
Description: PGP signature

