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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2022-07-08 19:26:11 +09:30
parent 68b45c2ae0
commit ba4e9b64b5

View File

@ -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,