degesch: Lua: fix configuration loading
Not the cleanest solution but it has to do for now.
This commit is contained in:
parent
79f46752d4
commit
aca153f575
|
@ -8003,6 +8003,8 @@ lua_plugin_add_config_schema (struct lua_plugin *plugin,
|
|||
schema->comment = NULL;
|
||||
schema->default_ = NULL;
|
||||
schema->type = CONFIG_ITEM_NULL;
|
||||
schema->on_change = lua_schema_item_on_change;
|
||||
schema->validate = lua_schema_item_validate;
|
||||
|
||||
// Try to update the defaults with values provided by the plugin
|
||||
int values = lua_absindex (L, -2);
|
||||
|
@ -8602,7 +8604,7 @@ lua_plugin_load (struct app_context *ctx, const char *filename,
|
|||
luaL_openlibs (L);
|
||||
|
||||
struct lua_plugin *plugin = xcalloc (1, sizeof *plugin);
|
||||
plugin->super.name = NULL;
|
||||
plugin->super.name = xstrdup (filename);
|
||||
plugin->super.vtable = &lua_plugin_vtable;
|
||||
plugin->ctx = ctx;
|
||||
plugin->L = L;
|
||||
|
@ -8714,9 +8716,12 @@ plugin_load (struct app_context *ctx, const char *name)
|
|||
struct plugin *plugin = plugin_load_by_name (ctx, name, &e);
|
||||
if (plugin)
|
||||
{
|
||||
// FIXME: this way the real name isn't available to the plugin on load
|
||||
free (plugin->name);
|
||||
plugin->name = xstrdup (name);
|
||||
|
||||
log_global_status (ctx, "Plugin \"#s\" loaded", name);
|
||||
LIST_PREPEND (ctx->plugins, plugin);
|
||||
plugin->name = xstrdup (name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue