parser_json: Fix checking of parse_policy() return code
Phil Sutter
reviewerPATCH 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")
Signed-off-by Phil Sutter <[email protected]>
--- src/parser_json.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/parser_json.c +1 -1
@@ -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
Quoted 5 lines · Phil Sutter
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")Signed-off-by Phil Sutter <[email protected]>