diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-03 00:58:09 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-03 00:58:09 +0000 |
commit | 13aeb82ad2462d3eb2952365fd944c8837d55ea8 (patch) | |
tree | eacc77f40fb81fef2a57c496f4c6c991b788bd66 /src | |
parent | 1c4abcfda1c8673b96d2ba11e379e9b7457f749f (diff) |
Proper error checking on loading cmd_*.so files
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5122 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/command_parse.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 83f4674c4..9b5dc5316 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -475,15 +475,16 @@ CommandParser::CommandParser(InspIRCd* Instance) : ServerInstance(Instance) this->SetupCommandTable(); } -void CommandParser::FindSym(void** v, void* h) +bool CommandParser::FindSym(void** v, void* h) { *v = dlsym(h, "init_command"); const char* err = dlerror(); if (err) { - printf("ERROR: %s\n",err); - exit(0); + ServerInstance->Log(SPARSE, "Error loading core command: %s\n", err); + return false; } + return true; } bool CommandParser::ReloadCommand(const char* cmd) @@ -542,13 +543,16 @@ void CommandParser::LoadCommand(const char* name) h = dlopen(filename, RTLD_NOW | RTLD_GLOBAL); if (!h) + { + ServerInstance->Log(SPARSE, "Error loading core command: %s", dlerror()); return; + } - this->FindSym((void **)&cmd_factory_func, h); - - command_t* newcommand = cmd_factory_func(ServerInstance); - - this->CreateCommand(newcommand, h); + if (this->FindSym((void **)&cmd_factory_func, h)) + { + command_t* newcommand = cmd_factory_func(ServerInstance); + this->CreateCommand(newcommand, h); + } } void CommandParser::SetupCommandTable() |