Start command might have included plugin-specific parameters. * We make sure they *are* parameters for this plugin, then add them * to our configvars. */
| 1563 | * We make sure they *are* parameters for this plugin, then add them |
| 1564 | * to our configvars. */ |
| 1565 | static const char *plugin_add_params(const struct plugin *plugin) |
| 1566 | { |
| 1567 | size_t i; |
| 1568 | const jsmntok_t *t; |
| 1569 | |
| 1570 | if (!plugin->params) |
| 1571 | return NULL; |
| 1572 | |
| 1573 | json_for_each_obj(i, t, plugin->params) { |
| 1574 | struct opt_table *ot; |
| 1575 | const char *name = json_strdup(tmpctx, plugin->parambuf, t); |
| 1576 | struct configvar *cv; |
| 1577 | const char *err; |
| 1578 | |
| 1579 | /* This serves two purposes; make sure we don't set an option |
| 1580 | * for a different pligin on the plugin start cmdline, and |
| 1581 | * make sure we clean it up, since we only clean our own |
| 1582 | * configvars in destroy_plugin_opt */ |
| 1583 | if (!plugin_opt_find(plugin, name)) |
| 1584 | return tal_fmt(plugin, "unknown parameter %s", name); |
| 1585 | |
| 1586 | ot = opt_find_long(name, NULL); |
| 1587 | if (ot->type & OPT_HASARG) { |
| 1588 | name = tal_fmt(NULL, "%s=%.*s", |
| 1589 | name, |
| 1590 | t[1].end - t[1].start, |
| 1591 | plugin->parambuf + t[1].start); |
| 1592 | } |
| 1593 | cv = configvar_new(plugin->plugins->ld->configvars, |
| 1594 | CONFIGVAR_PLUGIN_START, |
| 1595 | NULL, 0, take(name)); |
| 1596 | tal_arr_expand(&plugin->plugins->ld->configvars, cv); |
| 1597 | |
| 1598 | /* If this fails, we free plugin and unregister the configvar */ |
| 1599 | err = configvar_parse(cv, false, true, |
| 1600 | plugin->plugins->ld->developer); |
| 1601 | if (err) |
| 1602 | return err; |
| 1603 | } |
| 1604 | |
| 1605 | /* We might have overridden previous configvars */ |
| 1606 | configvar_finalize_overrides(plugin->plugins->ld->configvars); |
| 1607 | return NULL; |
| 1608 | } |
| 1609 | |
| 1610 | static void plugin_manifest_timeout(struct plugin *plugin) |
| 1611 | { |
no test coverage detected