If listing ruleset elements with '-j' flag, print a final newline to not
upset shell prompts.

Suggested-by: Pablo Neira Ayuso <pa...@netfilter.org>
Signed-off-by: Phil Sutter <p...@nwl.cc>
---
 src/json.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/json.c b/src/json.c
index 4e64684201638..1484c21be819a 100644
--- a/src/json.c
+++ b/src/json.c
@@ -1752,6 +1752,8 @@ int do_command_list_json(struct netlink_ctx *ctx, struct 
cmd *cmd)
        root = json_pack("{s:o}", "nftables", root);
        json_dumpf(root, ctx->nft->output.output_fp, 0);
        json_decref(root);
+       fprintf(ctx->nft->output.output_fp, "\n");
+       fflush(ctx->nft->output.output_fp);
        return 0;
 }
 
-- 
2.21.0

Reply via email to