From 50f227dafe90efffb57eb483af25ae279218ad9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= Date: Sun, 5 May 2019 11:05:29 +0200 Subject: [PATCH] sensors: json: Skip printing an unnecessary newline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't print a newline if no features were printed. This is based on a patch from the su8 user on GitHub. Signed-off-by: Ondřej Lysoněk --- prog/sensors/chips.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 7ec74912..c293ae44 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -112,7 +112,8 @@ void print_chip_json(const sensors_chip_name *name) printf("\n }"); cnt++; } - printf("\n"); + if (cnt > 0) + printf("\n"); } static const char hyst_str[] = "hyst";