MCPcopy Create free account
hub / github.com/ElementsProject/lightning / config_not_writable

Function config_not_writable

lightningd/configs.c:625–651  ·  view source on GitHub ↗

Returns config file name if not writable */

Source from the content-addressed store, hash-verified

623
624/* Returns config file name if not writable */
625static const char *config_not_writable(const tal_t *ctx,
626 struct command *cmd,
627 const struct configvar *oldcv)
628{
629 struct lightningd *ld = cmd->ld;
630 const char *fname;
631
632 /* If it exists before, we will need to replace that file (rename) */
633 if (oldcv && oldcv->file) {
634 /* We will rename */
635 if (!dir_writable(oldcv->file))
636 return oldcv->file;
637 }
638
639 /* If we don't have a setconfig file we'll have to create it, and
640 * amend the config file. */
641 if (!ld->setconfig_file) {
642 fname = base_conf_file(tmpctx, ld, NULL);
643 if (!dir_writable(fname))
644 return tal_steal(ctx, fname);
645 } else {
646 /* We will try to append config.setconfig */
647 if (!file_writable(ld->setconfig_file))
648 return tal_strdup(ctx, ld->setconfig_file);
649 }
650 return NULL;
651}
652
653static struct command_result *json_setconfig(struct command *cmd,
654 const char *buffer,

Callers 1

json_setconfigFunction · 0.85

Calls 3

dir_writableFunction · 0.85
base_conf_fileFunction · 0.85
file_writableFunction · 0.85

Tested by

no test coverage detected