Skip to content

Commit 8369ca7

Browse files
vincenzopalazzorustyrussell
authored andcommitted
cli: accepts long paths as options
This allows to accept safely long paths as options and does not truncate them as ElementsProject#5576 described Changelog-Fixed: cli: accepts long paths as options Suggested-by: @rustyrussell <[email protected]> Signed-off-by: Vincenzo Palazzo <[email protected]>
1 parent 59ed23e commit 8369ca7

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lightningd/options.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,6 +1644,9 @@ static void add_config(struct lightningd *ld,
16441644
} else if (opt->type & OPT_HASARG) {
16451645
if (opt->desc == opt_hidden) {
16461646
/* Ignore hidden options (deprecated) */
1647+
} else if (opt->show == (void *)opt_show_charp) {
1648+
/* Don't truncate! */
1649+
answer = tal_strdup(tmpctx, *(char **)opt->u.carg);
16471650
} else if (opt->show) {
16481651
opt->show(buf, opt->u.carg);
16491652
strcpy(buf + OPT_SHOW_LEN - 1, "...");
@@ -1655,14 +1658,7 @@ static void add_config(struct lightningd *ld,
16551658
json_add_primitive(response, name0, buf);
16561659
return;
16571660
}
1658-
1659-
/* opt_show_charp surrounds with "", strip them */
1660-
if (strstarts(buf, "\"")) {
1661-
char *end = strrchr(buf, '"');
1662-
memmove(end, end + 1, strlen(end));
1663-
answer = buf + 1;
1664-
} else
1665-
answer = buf;
1661+
answer = buf;
16661662
} else if (opt->cb_arg == (void *)opt_set_talstr
16671663
|| opt->cb_arg == (void *)opt_set_charp
16681664
|| is_restricted_print_if_nonnull(opt->cb_arg)) {

0 commit comments

Comments
 (0)