mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-09 00:54:22 +01:00
fix crash with lightning charge and plugin opts (#2358)
* fix crash with lightning charge and plugin opts
This commit is contained in:
committed by
Christian Decker
parent
3e4a3bafc3
commit
503360143a
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user