From aeee3083aa1b64abb25d66c9763518ca017f0ea0 Mon Sep 17 00:00:00 2001 From: "xiang.zhou" Date: Sun, 29 Sep 2024 15:14:23 +0800 Subject: [PATCH] plugin:rm so and schema file when remove custom plugin --- src/core/plugin_manager.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/core/plugin_manager.c b/src/core/plugin_manager.c index a4632d10..01a3ab40 100644 --- a/src/core/plugin_manager.c +++ b/src/core/plugin_manager.c @@ -252,6 +252,20 @@ int neu_plugin_manager_del(neu_plugin_manager_t *mgr, const char *plugin_name) HASH_FIND_STR(mgr->plugins, plugin_name, plugin); if (plugin != NULL) { if (plugin->kind != NEU_PLUGIN_KIND_SYSTEM) { + + char so_file_path[128] = { 0 }; + char schema_file_path[128] = { 0 }; + snprintf(so_file_path, sizeof(so_file_path), "%s/custom/%s", + g_plugin_dir, plugin->lib_name); + snprintf(schema_file_path, sizeof(schema_file_path), + "%s/custom/schema/%s.json", g_plugin_dir, plugin->schema); + if (remove(so_file_path) != 0) { + nlog_error("rm %s file fail!", so_file_path); + } + if (remove(schema_file_path) != 0) { + nlog_error("rm %s file fail!", schema_file_path); + } + HASH_DEL(mgr->plugins, plugin); entity_free(plugin); ret = NEU_ERR_SUCCESS;