From ba4e9b64b57fa09ccf9adbac7bb9533aed17a607 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 8 Jul 2022 19:26:11 +0930 Subject: [PATCH] options: print empty options properly. Noticed by log-prefix default (""), which causes bad JSON: ``` Malformed JSON reply '{"jsonrpc":"2.0","id":0,"result":{... "log-prefix":,"log-file":"log"} } ``` Signed-off-by: Rusty Russell --- lightningd/options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lightningd/options.c b/lightningd/options.c index 2af57ac09..454131f3e 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -1556,7 +1556,7 @@ static void add_config(struct lightningd *ld, strcpy(buf + OPT_SHOW_LEN - 1, "..."); if (streq(buf, "true") || streq(buf, "false") - || strspn(buf, "0123456789.") == strlen(buf)) { + || (!streq(buf, "") && strspn(buf, "0123456789.") == strlen(buf))) { /* Let pure numbers and true/false through as * literals. */ json_add_literal(response, name0,