[libvirt] [PATCH 01/10] virRandomBytes: Fix return value
Eric Blake
eblake at redhat.com
Tue May 29 20:19:28 UTC 2018
On 05/29/2018 03:24 AM, Michal Privoznik wrote:
> In libvirt when a function wants to return an error code it
> should be a negative value. Returning a positive value (or zero)
> means success. But virRandomBytes() does not follow this rule.
>
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
> src/util/vircrypto.c | 4 ++--
> src/util/virrandom.c | 6 +++---
> src/util/viruuid.c | 4 ++--
> tests/vircryptotest.c | 4 ++--
> 4 files changed, 9 insertions(+), 9 deletions(-)
>
> +++ b/src/util/virrandom.c
> @@ -168,7 +168,7 @@ uint32_t virRandomInt(uint32_t max)
> * Generate a stream of random bytes from /dev/urandom
> * into @buf of size @buflen
> *
> - * Returns 0 on success or an errno on failure
> + * Returns 0 on success or an -errno on failure
"an negative" sounds awkward when pronounced; I'd go with s/an //
With that tweak,
Reviewed-by: Eric Blake <eblake at redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
More information about the libvir-list
mailing list