Plugin fixes for FreeBSD.

This commit is contained in:
Robin Sommer 2014-06-19 13:21:36 -07:00
parent 62d07a3fc4
commit 48c6b934f4
4 changed files with 14 additions and 10 deletions

2
cmake

@ -1 +1 @@
Subproject commit d1c44af3a6cc89f3f277a7585f8f87f1d98782eb
Subproject commit 6ebf7598f4932cecf0926705f815cb5634be21b9

View file

@ -387,6 +387,10 @@ else ()
target_link_libraries(bro ${bro_SUBDIRS} ${brodeps} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
endif ()
if ( NOT "${bro_LINKER_FLAGS}" STREQUAL "" )
set_target_properties(bro PROPERTIES LINK_FLAGS "${bro_LINKER_FLAGS}")
endif ()
install(TARGETS bro DESTINATION bin)
set(BRO_EXE bro

View file

@ -17,8 +17,8 @@
using namespace plugin;
Plugin* Manager::current_plugin = 0;
string Manager::current_dir;
string Manager::current_sopath;
const char* Manager::current_dir = 0;
const char* Manager::current_sopath = 0;
Manager::Manager()
{
@ -199,7 +199,7 @@ bool Manager::ActivateDynamicPluginInternal(const std::string& name, bool ok_if_
const char* path = gl.gl_pathv[i];
current_plugin = 0;
current_dir = dir;
current_dir = dir.c_str();
current_sopath = path;
void* hdl = dlopen(path, RTLD_LAZY | RTLD_GLOBAL);
@ -226,8 +226,8 @@ bool Manager::ActivateDynamicPluginInternal(const std::string& name, bool ok_if_
reporter->FatalError("inconsistent plugin name: %s vs %s",
current_plugin->Name().c_str(), name.c_str());
current_dir.clear();
current_sopath.clear();
current_dir = 0;
current_sopath = 0;
current_plugin = 0;
DBG_LOG(DBG_PLUGINS, " Loaded %s", path);
@ -294,9 +294,9 @@ void Manager::RegisterPlugin(Plugin *plugin)
{
Manager::ActivePluginsInternal()->push_back(plugin);
if ( current_dir.size() && current_sopath.size() )
if ( current_dir && current_sopath )
// A dynamic plugin, record its location.
plugin->SetPluginLocation(current_dir.c_str(), current_sopath.c_str());
plugin->SetPluginLocation(current_dir, current_sopath);
// Sort plugins by name to make sure we have a deterministic order.
ActivePluginsInternal()->sort(plugin_cmp);

View file

@ -321,8 +321,8 @@ private:
// Helpers providing access to current state during dlopen().
static Plugin* current_plugin;
static string current_dir;
static string current_sopath;
static const char* current_dir;
static const char* current_sopath;
// Returns a modifiable list of all plugins, both static and dynamic.
// This is a static method so that plugins can register themselves