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

Function config_not_writable

lightningd/configs.c:624–650  ·  view source on GitHub ↗

Returns config file name if not writable */

Source from the content-addressed store, hash-verified

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