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

Daniel Veillard veillard at redhat.com
Mon Jan 11 09:18:56 UTC 2010


On Fri, Jan 08, 2010 at 12:51:44PM -0500, Laine Stump wrote:
> 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.  */

  Ah, right, ACK, pushed,

   thanks !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list