代码拉取完成,页面将自动刷新
From 5130ce8ee5b71c249e0c8bb7a4975dc8a48c64fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas@t-8ch.de>
Date: Tue, 12 Dec 2023 18:42:44 +0100
Subject: [PATCH] libsmartcols: only recognize closed object as final element
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When streaming JSON normal values also have indent == 1.
For those however it is incorrect to close the stream.
Fixes #2644
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Reference:https://github.com/util-linux/util-linux/commit/5130ce8ee5b71c249e0c8bb7a4975dc8a48c64fa
Conflict:NA
---
lib/jsonwrt.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/lib/jsonwrt.c b/lib/jsonwrt.c
index dc20d2e46..243ed8232 100644
--- a/lib/jsonwrt.c
+++ b/lib/jsonwrt.c
@@ -154,12 +154,6 @@ void ul_jsonwrt_open(struct ul_jsonwrt *fmt, const char *name, int type)
void ul_jsonwrt_close(struct ul_jsonwrt *fmt, int type)
{
- if (fmt->indent == 1) {
- fputs("\n}\n", fmt->out);
- fmt->indent--;
- fmt->after_close = 1;
- return;
- }
assert(fmt->indent > 0);
switch (type) {
@@ -168,6 +162,8 @@ void ul_jsonwrt_close(struct ul_jsonwrt *fmt, int type)
fputc('\n', fmt->out);
ul_jsonwrt_indent(fmt);
fputs("}", fmt->out);
+ if (fmt->indent == 0)
+ fputs("\n", fmt->out);
break;
case UL_JSON_ARRAY:
fmt->indent--;
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。