For multi options: remove all existing, add all new values */
| 533 | |
| 534 | /* For multi options: remove all existing, add all new values */ |
| 535 | static void configvar_save_multi(struct lightningd *ld, |
| 536 | const char **names, |
| 537 | const char **conflines, |
| 538 | size_t nvals) |
| 539 | { |
| 540 | size_t linenum; |
| 541 | |
| 542 | if (!ld->setconfig_file) |
| 543 | create_setconfig_include(ld); |
| 544 | |
| 545 | /* Comment out all file-based values, even overridden ones. */ |
| 546 | for (size_t i = 0; i < tal_count(ld->configvars); i++) { |
| 547 | struct configvar *cv = ld->configvars[i]; |
| 548 | if (cv->optvar && streq(cv->optvar, names[0]) && cv->file) |
| 549 | configfile_replace_var(ld, cv, NULL); |
| 550 | } |
| 551 | |
| 552 | configvar_remove(&ld->configvars, names[0], CONFIGVAR_NETWORK_CONF, NULL); |
| 553 | |
| 554 | for (size_t i = 0; i < nvals; i++) { |
| 555 | linenum = append_to_file(ld, ld->setconfig_file, conflines[i], true); |
| 556 | configvar_updated(ld, CONFIGVAR_NETWORK_CONF, |
| 557 | ld->setconfig_file, linenum, conflines[i]); |
| 558 | } |
| 559 | } |
| 560 | |
| 561 | static struct command_result *setconfig_success(struct command *cmd, |
| 562 | const struct opt_table *ot, |
no test coverage detected