summaryrefslogtreecommitdiff
path: root/lib/parse.c
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2013-01-07 17:07:52 +0100
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2013-01-09 23:33:48 +0100
commit96f32b9e6fe70bae429c1feb2c711e1293f3a31d (patch)
tree42679927a0f390282c8bf4c3b74ddf5d29f0c307 /lib/parse.c
parent0c81d2074139396786aec84086afa162cd20dcda (diff)
downloadipset-96f32b9e6fe70bae429c1feb2c711e1293f3a31d.tar.gz
Correct "Suspicious condition (assignment + comparison)" (Thomas Jarosch)
cppcheck (vaguely) reported: [lib/parse.c:448]: (style) Suspicious condition (assignment + comparison); Clarify expression with parentheses.
Diffstat (limited to 'lib/parse.c')
-rw-r--r--lib/parse.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/parse.c b/lib/parse.c
index 550048c..951d2f3 100644
--- a/lib/parse.c
+++ b/lib/parse.c
@@ -442,11 +442,10 @@ ipset_parse_proto(struct ipset_session *session,
protoent = getprotobyname(strcasecmp(str, "icmpv6") == 0
? "ipv6-icmp" : str);
if (protoent == NULL) {
- uint8_t protonum;
- int err;
+ uint8_t protonum = 0;
- if (!((err = string_to_u8(session, str, &protonum) == 0) &&
- (protoent = getprotobynumber(protonum)) != NULL))
+ if (string_to_u8(session, str, &protonum) ||
+ (protoent = getprotobynumber(protonum)) == NULL)
return syntax_err("cannot parse '%s' "
"as a protocol", str);
}