30 Oct
2021
30 Oct
'21
4:56 p.m.
We return on successful if, so the else is not needed. This makes the flow more clear. Signed-off-by: Nir Soffer <nsoffer@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