Look for symbols in plugins using instead of for more portable use
This commit is contained in:
parent
84ac4a1e49
commit
c509868345
1 changed files with 4 additions and 3 deletions
|
|
@ -47,6 +47,7 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#define __USE_GNU /* For RTLD_DEFAULT */
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
|
|
@ -213,8 +214,6 @@ clixon_str2fn(char *name,
|
||||||
{
|
{
|
||||||
void *fn = NULL;
|
void *fn = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Reset error */
|
/* Reset error */
|
||||||
*error = NULL;
|
*error = NULL;
|
||||||
/* Special check for auto-cli. If the virtual callback is used, it should be overwritten later
|
/* Special check for auto-cli. If the virtual callback is used, it should be overwritten later
|
||||||
|
|
@ -236,7 +235,9 @@ clixon_str2fn(char *name,
|
||||||
* master plugin if it exists
|
* master plugin if it exists
|
||||||
*/
|
*/
|
||||||
dlerror(); /* Clear any existing error */
|
dlerror(); /* Clear any existing error */
|
||||||
fn = dlsym(NULL, name);
|
/* RTLD_DEFAULT instead of NULL for linux + FreeBSD:
|
||||||
|
* Use default search algorithm. Thanks jdl@netgate.com */
|
||||||
|
fn = dlsym(RTLD_DEFAULT, name);
|
||||||
if ((*error = (char*)dlerror()) == NULL)
|
if ((*error = (char*)dlerror()) == NULL)
|
||||||
return fn; /* If no error we found the address of the callback */
|
return fn; /* If no error we found the address of the callback */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue