diff mbox

[2/4] iptables: iptables: Remove assignment in if condition

Message ID 20170331161351.26141-3-arushisinghal19971997@gmail.com
State Not Applicable
Delegated to: Pablo Neira
Headers show

Commit Message

Arushi Singhal March 31, 2017, 4:13 p.m. UTC
Remove the assignment from if condition to follow kernel coding style
and make the code more clear and readable.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
---
 iptables/getethertype.c | 3 ++-
 iptables/nft-arp.c      | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/iptables/getethertype.c b/iptables/getethertype.c
index bf3e408..11c121a 100644
--- a/iptables/getethertype.c
+++ b/iptables/getethertype.c
@@ -84,7 +84,8 @@  struct ethertypeent *getethertypeent(void)
 	}
 
 again:
-	if ((e = fgets(line, BUFSIZ, etherf)) == NULL) {
+	e = fgets(line, BUFSIZ, etherf);
+	if (!e) {
 		return (NULL);
 	}
 	if (*e == '#')
diff --git a/iptables/nft-arp.c b/iptables/nft-arp.c
index 0e13b8c..37ed956 100644
--- a/iptables/nft-arp.c
+++ b/iptables/nft-arp.c
@@ -70,7 +70,8 @@  addr_to_network(const struct in_addr *addr)
 {
 	struct netent *net;
 
-	if ((net = getnetbyaddr((long) ntohl(addr->s_addr), AF_INET)) != NULL)
+	net = getnetbyaddr((long) ntohl(addr->s_addr), AF_INET);
+	if (net)
 		return (char *) net->n_name;
 
 	return (char *) NULL;