Re: [PATCH 01/10] virRandomBytes: Fix return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
  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@xxxxxxxxxx>

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux