On Tue, Apr 25, 2017 at 08:52:58AM -0500, Eric Blake wrote: > On 04/25/2017 08:42 AM, Daniel P. Berrange wrote: > > On Mon, Apr 24, 2017 at 07:51:49PM +0200, Geert Martin Ijewski wrote: > >> If no crypto library is included in the build QEMU uses > >> qcrypto_random_bytes() to generate random data. That function tried to open > >> /dev/urandom or /dev/random and if openeing neither file worked it errored > >> out. > >> > > >> +int qcrypto_random_init(Error **errp) > >> +{ > >> +#ifdef _WIN32 > >> + if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, > >> + CRYPT_SILENT | CRYPT_VERIFYCONTEXT)) { > >> + error_setg_errno(errp, GetLastError(), > >> + "Unable to create cryptographic provider"); > > > > Unfortunately the return value of 'GetLastError()' isn't an errno > > so we can't use error_setg_errno here. > > > > Just use error_setg, and report the error value with a '(code=%u)' > > substitution at the end of the error message. > > > > Or, use error_setg_win32(), which is designed for this purpose.
Oh nice, didn't know that existed ! Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|