Use RTLD_NOW where available, and define it to RTLD_LAZY otherwise.

git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@238 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
Dag-Erling Smørgrav 2003-05-25 13:41:46 +00:00
parent 9a08cc3e52
commit 49189d9bbc
1 changed files with 7 additions and 3 deletions

View File

@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $P4: //depot/projects/openpam/lib/openpam_dynamic.c#11 $
* $P4: //depot/projects/openpam/lib/openpam_dynamic.c#12 $
*/
#include <dlfcn.h>
@ -43,6 +43,10 @@
#include "openpam_impl.h"
#ifndef RTLD_NOW
#define RTLD_NOW RTLD_LAZY
#endif
/*
* OpenPAM internal
*
@ -64,10 +68,10 @@ openpam_dynamic(const char *path)
/* try versioned module first, then unversioned module */
if (asprintf(&vpath, "%s.%d", path, LIB_MAJ) < 0)
goto buf_err;
if ((dlh = dlopen(vpath, RTLD_LAZY)) == NULL) {
if ((dlh = dlopen(vpath, RTLD_NOW)) == NULL) {
openpam_log(PAM_LOG_DEBUG, "%s: %s", vpath, dlerror());
*strrchr(vpath, '.') = '\0';
if ((dlh = dlopen(vpath, RTLD_LAZY)) == NULL) {
if ((dlh = dlopen(vpath, RTLD_NOW)) == NULL) {
openpam_log(PAM_LOG_DEBUG, "%s: %s", vpath, dlerror());
FREE(module);
return (NULL);