diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-01-06 20:11:46 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-01-06 20:11:46 +0000 |
commit | 9d4ce9a5d50788ac8c636881861cb1c2ab45fc52 (patch) | |
tree | 169f36586a608bb9e28d92f76a5612a09e492d23 /ext | |
parent | e7b91b67de5d0f0f6a116fcb08b706e17f3f0bd8 (diff) | |
download | perl-9d4ce9a5d50788ac8c636881861cb1c2ab45fc52.tar.gz |
add workaround for dlopen() bug on OpenBSD (relative paths that
match /^lib/ won't load properly)
p4raw-id: //depot/perl@4765
Diffstat (limited to 'ext')
-rw-r--r-- | ext/DynaLoader/dl_dlopen.xs | 17 | ||||
-rw-r--r-- | ext/DynaLoader/hints/openbsd.pl | 3 |
2 files changed, 17 insertions, 3 deletions
diff --git a/ext/DynaLoader/dl_dlopen.xs b/ext/DynaLoader/dl_dlopen.xs index 9c07e60464..135f5112f2 100644 --- a/ext/DynaLoader/dl_dlopen.xs +++ b/ext/DynaLoader/dl_dlopen.xs @@ -146,9 +146,20 @@ void * dl_load_file(filename, flags=0) char * filename int flags - PREINIT: + PREINIT: int mode = RTLD_LAZY; - CODE: + CODE: +{ +#if defined(DLOPEN_WONT_DO_RELATIVE_PATHS) + char pathbuf[PATH_MAX + 2]; + if (*filename != '/' && strchr(filename, '/')) { + if (getcwd(pathbuf, PATH_MAX - strlen(filename))) { + strcat(pathbuf, "/"); + strcat(pathbuf, filename); + filename = pathbuf; + } + } +#endif #ifdef RTLD_NOW if (dl_nonlazy) mode = RTLD_NOW; @@ -167,7 +178,7 @@ dl_load_file(filename, flags=0) SaveError(aTHX_ "%s",dlerror()) ; else sv_setiv( ST(0), PTR2IV(RETVAL)); - +} void * dl_find_symbol(libhandle, symbolname) diff --git a/ext/DynaLoader/hints/openbsd.pl b/ext/DynaLoader/hints/openbsd.pl new file mode 100644 index 0000000000..aeaa92c5a5 --- /dev/null +++ b/ext/DynaLoader/hints/openbsd.pl @@ -0,0 +1,3 @@ +# XXX Configure test needed? +# Some OpenBSDs seem to have a dlopen() that won't accept relative paths +$self->{CCFLAGS} = $Config{ccflags} . ' -DDLOPEN_WONT_DO_RELATIVE_PATHS'; |