json_script: fix logic invert of handle_expr_not().
authorYousong Zhou <yszhou4tech@gmail.com>
Tue, 16 Dec 2014 21:15:36 +0000 (05:15 +0800)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 22 Dec 2014 14:46:21 +0000 (15:46 +0100)
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
json_script.c

index 6a17d3bd1ff7be7737ca322a30a3e9f46245f288..73c25022e11c8d42e23077c8b08146b28ba30abd 100644 (file)
@@ -333,12 +333,16 @@ static int handle_expr_or(struct json_call *call, struct blob_attr *expr)
 static int handle_expr_not(struct json_call *call, struct blob_attr *expr)
 {
        struct blob_attr *tb[3];
+       int ret;
 
        json_get_tuple(expr, tb, BLOBMSG_TYPE_ARRAY, 0);
        if (!tb[1])
                return -1;
 
-       return json_process_expr(call, tb[1]);
+       ret = json_process_expr(call, tb[1]);
+       if (ret < 0)
+               return ret;
+       return !ret;
 }
 
 static const struct json_handler expr[] = {