diff mbox series

[ipset,2/4] Simplify return statement in ipset_mnl_query()

Message ID 8cdcb4bb3baab5297b880382d70dca8645cc6255.1534929327.git.sbrivio@redhat.com
State Accepted
Delegated to: Jozsef Kadlecsik
Headers show
Series Fix issues reported by Covscan | expand

Commit Message

Stefano Brivio Aug. 22, 2018, 9:22 a.m. UTC
As we loop as long as 'ret' is greater than zero, and break only
if we get an error in mnl_cb_run2 (with ret <= 0), we can just
return ret without checking once more if it's greater than zero.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
 lib/mnl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jozsef Kadlecsik Aug. 24, 2018, 7:03 p.m. UTC | #1
On Wed, 22 Aug 2018, Stefano Brivio wrote:

> As we loop as long as 'ret' is greater than zero, and break only
> if we get an error in mnl_cb_run2 (with ret <= 0), we can just
> return ret without checking once more if it's greater than zero.
> 
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
> ---
>  lib/mnl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/mnl.c b/lib/mnl.c
> index a0fa66ecdb80..4e075cf94f00 100644
> --- a/lib/mnl.c
> +++ b/lib/mnl.c
> @@ -115,7 +115,7 @@ ipset_mnl_query(struct ipset_handle *handle, void *buffer, size_t len)
>  		ret = mnl_socket_recvfrom(handle->h, buffer, len);
>  		D("message received, ret: %d", ret);
>  	}
> -	return ret > 0 ? 0 : ret;
> +	return ret;
>  }

Patch is applied, thanks.

Best regards,
Jozsef
-
E-mail  : kadlec@blackhole.kfki.hu, kadlecsik.jozsef@wigner.mta.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
          H-1525 Budapest 114, POB. 49, Hungary
diff mbox series

Patch

diff --git a/lib/mnl.c b/lib/mnl.c
index a0fa66ecdb80..4e075cf94f00 100644
--- a/lib/mnl.c
+++ b/lib/mnl.c
@@ -115,7 +115,7 @@  ipset_mnl_query(struct ipset_handle *handle, void *buffer, size_t len)
 		ret = mnl_socket_recvfrom(handle->h, buffer, len);
 		D("message received, ret: %d", ret);
 	}
-	return ret > 0 ? 0 : ret;
+	return ret;
 }
 
 static struct ipset_handle *