[nft PATCH 1/2] json: Print newline at end of list output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Suggested-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
Signed-off-by: Phil Sutter <phil@xxxxxx>
---
 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




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux