Browse Source

fix crash with lightning charge and plugin opts (#2358)

* fix crash with lightning charge and plugin opts
connected_hook
Richard Bondi 6 years ago
committed by Christian Decker
parent
commit
503360143a
  1. 3
      lightningd/options.c
  2. 6
      lightningd/plugin.c
  3. 12
      lightningd/plugin.h

3
lightningd/options.c

@ -1027,7 +1027,8 @@ static void add_config(struct lightningd *ld,
} else if (opt->cb_arg == (void *)opt_add_plugin) {
json_add_opt_plugins(response, ld->plugins);
} else if (opt->cb_arg == (void *)opt_add_plugin_dir
|| opt->cb_arg == (void *)opt_disable_plugin) {
|| opt->cb_arg == (void *)opt_disable_plugin
|| opt->cb_arg == (void *)plugin_opt_set) {
/* FIXME: We actually treat it as if they specified
* --plugin for each one, so ignore these */
#if DEVELOPER

6
lightningd/plugin.c

@ -81,8 +81,6 @@ struct plugins {
struct lightningd *ld;
};
/* Simple storage for plugin options inbetween registering them on the
* command line and passing them off to the plugin */
struct plugin_opt {
struct list_node list;
const char *name;
@ -463,9 +461,7 @@ static struct io_plan *plugin_stdout_conn_init(struct io_conn *conn,
plugin_read_json, plugin);
}
/* Callback called when parsing options. It just stores the value in
* the plugin_opt */
static char *plugin_opt_set(const char *arg, struct plugin_opt *popt)
char *plugin_opt_set(const char *arg, struct plugin_opt *popt)
{
tal_free(popt->value);
popt->value = tal_strdup(popt, arg);

12
lightningd/plugin.h

@ -18,6 +18,12 @@ struct plugins;
*/
struct plugin;
/**
* Simple storage for plugin options inbetween registering them on the
* command line and passing them off to the plugin
*/
struct plugin_opt;
/**
* Create a new plugins context.
*/
@ -93,4 +99,10 @@ void plugins_notify(struct plugins *plugins,
void plugin_request_send(struct plugin *plugin,
struct jsonrpc_request *req TAKES);
/**
* Callback called when parsing options. It just stores the value in
* the plugin_opt
*/
char *plugin_opt_set(const char *arg, struct plugin_opt *popt);
#endif /* LIGHTNING_LIGHTNINGD_PLUGIN_H */

Loading…
Cancel
Save