X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=blobdiff_plain;f=src%2Fcore%2Fplugin.c;h=76fc2092d022ff8588a2b5f11739e8653fa5c1c4;hp=67f9dfea05259610299d5838623b863f820fc87f;hb=2d39d666abde2d66a55ac4536da3f250d9513f48;hpb=233d70fd5ffdc770e639da722a8070cb73ec4fc6 diff --git a/src/core/plugin.c b/src/core/plugin.c index 67f9dfe..76fc209 100644 --- a/src/core/plugin.c +++ b/src/core/plugin.c @@ -726,6 +726,7 @@ module_load(const char *basedir, const char *name, if ((status = module_init(name, lh, &ctx->info))) { sdb_object_deref(SDB_OBJ(ctx)); + ctx_set(NULL); return status; } @@ -953,13 +954,13 @@ sdb_plugin_load(const char *basedir, const char *name, ctx_t *old_ctx = ctx_set(ctx); status = module_init(ctx->info.plugin_name, ctx->handle, NULL); + ctx_set(old_ctx); if (status) return status; sdb_log(SDB_LOG_INFO, "core: Successfully reloaded plugin " "'%s' (%s)", ctx->info.plugin_name, INFO_GET(&ctx->info, description)); - ctx_set(old_ctx); } ++ctx->use_cnt; return 0; @@ -1196,7 +1197,7 @@ sdb_plugin_get_ctx(void) c = ctx_get(); if (! c) { - sdb_plugin_log(SDB_LOG_ERR, "core: Invalid read access to plugin " + sdb_log(SDB_LOG_ERR, "core: Invalid read access to plugin " "context outside a plugin"); return plugin_default_ctx; } @@ -1210,7 +1211,7 @@ sdb_plugin_set_ctx(sdb_plugin_ctx_t ctx, sdb_plugin_ctx_t *old) c = ctx_get(); if (! c) { - sdb_plugin_log(SDB_LOG_ERR, "core: Invalid write access to plugin " + sdb_log(SDB_LOG_ERR, "core: Invalid write access to plugin " "context outside a plugin"); return -1; }