Nir Soffer
2021-Oct-31 15:38 UTC
[Libguestfs] [PATCH libnbd v2 8/8] lib/crypto.c: Remove unneeded else
We return on successful if, so the else is not needed. This makes the
flow more clear.
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
lib/crypto.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/crypto.c b/lib/crypto.c
index 09d98fd..340a6a0 100644
--- a/lib/crypto.c
+++ b/lib/crypto.c
@@ -147,10 +147,12 @@ nbd_unlocked_get_tls_username (struct nbd_handle *h)
free (str.ptr);
return NULL;
}
+
if (getlogin_r (str.ptr, str.cap) == 0) {
return str.ptr;
}
- else if (errno != ERANGE) {
+
+ if (errno != ERANGE) {
set_error (errno, "getlogin_r");
free (str.ptr);
return NULL;
--
2.31.1
Richard W.M. Jones
2021-Oct-31 16:06 UTC
[Libguestfs] [PATCH libnbd v2 8/8] lib/crypto.c: Remove unneeded else
Yes it seems fine now, thanks Nir. ACK series Can you make sure nbdkit is synchronised with this? (No need to post that for review.) Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Nir Soffer
2021-Nov-05 23:27 UTC
[Libguestfs] [PATCH libnbd v2 8/8] lib/crypto.c: Remove unneeded else
On Sun, Oct 31, 2021 at 6:07 PM Richard W.M. Jones <rjones at redhat.com> wrote:> > > Yes it seems fine now, thanks Nir. > > ACK series > > Can you make sure nbdkit is synchronised with this? (No need to post > that for review.)The changes in nbdkit are more invasive, in code I never looked at, so I think you and Eric should review: https://listman.redhat.com/archives/libguestfs/2021-November/msg00035.html