diff --git a/apps/cli/cli_plugin.c b/apps/cli/cli_plugin.c index 818b34c0..d283dcb0 100644 --- a/apps/cli/cli_plugin.c +++ b/apps/cli/cli_plugin.c @@ -47,6 +47,7 @@ #include #include #include +#define __USE_GNU /* For RTLD_DEFAULT */ #include #include #include @@ -212,8 +213,6 @@ clixon_str2fn(char *name, char **error) { void *fn = NULL; - - /* Reset error */ *error = NULL; @@ -236,7 +235,9 @@ clixon_str2fn(char *name, * master plugin if it exists */ 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) return fn; /* If no error we found the address of the callback */