Skip to contentSkip to conversation

parser_json: Fix checking of parse_policy() return code

PATCH In review Phil Sutter 2 participants 2 messages Oct 21, 2019 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 parser_json: Fix checking of parse_policy() return code

The function was changed to return an expression or NULL but error checking wasn't adjusted while doing so.

Fixes dba4a9b4b5fe2 ("src: allow variable in chain policy")
---
 src/parser_json.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/parser_json.c +1 -1
index 55dbc177cc98d..fe0c5df98f5d4 100644
@@ -2630,7 +2630,7 @@ static struct cmd *json_parse_cmd_add_chain(struct json_ctx *ctx, json_t *root,
 		chain->dev = xstrdup(chain->dev);
 	if (!json_unpack(root, "{s:s}", "policy", &policy)) {
 		chain->policy = parse_policy(policy);
-		if (chain->policy < 0) {
+		if (!chain->policy) {
 			json_error(ctx, "Unknown policy '%s'.", policy);
 			chain_free(chain);
 			return NULL;
Signature · 1 line
2.23.0