]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
devlink: Fix boolean JSON print
authorAya Levin <ayal@mellanox.com>
Thu, 28 Feb 2019 12:12:56 +0000 (14:12 +0200)
committerDavid Ahern <dsahern@gmail.com>
Thu, 28 Feb 2019 15:55:30 +0000 (07:55 -0800)
This patch removes the inverted commas from boolean values in JSON
format: true/false instead of "true"/"false".

Signed-off-by: Aya Levin <ayal@mellanox.com>
Reviewed-by: Moshe Shemesh <moshe@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
devlink/devlink.c

index 8a28b5d5c26fd0e681dbc8884867e701ce75bb69..4b7e8ec2c88af32a72fdcdb456c4895f4b19f422 100644 (file)
@@ -1628,10 +1628,10 @@ static void pr_out_str(struct dl *dl, const char *name, const char *val)
 
 static void pr_out_bool(struct dl *dl, const char *name, bool val)
 {
-       if (val)
-               pr_out_str(dl, name, "true");
+       if (dl->json_output)
+               jsonw_bool_field(dl->jw, name, val);
        else
-               pr_out_str(dl, name, "false");
+               pr_out_str(dl, name, val ? "true" : "false");
 }
 
 static void pr_out_uint(struct dl *dl, const char *name, unsigned int val)