Skip to content

Commit 5d90405

Browse files
committed
OpenBSD does not have RTLD_NOLOAD.
Don't try to unconditionally use it. I don't know if this has any untoward side effects but running tests seems to be generally OK.
1 parent 1bcf2e3 commit 5d90405

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CoreFoundation/PlugIn.subproj/CFBundle_Binary.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,11 @@ CF_PRIVATE Boolean _CFBundleDlfcnCheckLoaded(CFBundleRef bundle) {
470470
char buff[CFMaxPathSize];
471471

472472
if (executableURL && CFURLGetFileSystemRepresentation(executableURL, true, (uint8_t *)buff, CFMaxPathSize)) {
473+
#if !defined(__OpenBSD__)
473474
int mode = RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD | RTLD_FIRST;
475+
#else
476+
int mode = RTLD_LAZY | RTLD_LOCAL | RTLD_FIRST;
477+
#endif
474478
void *handle = dlopen(buff, mode);
475479
if (handle) {
476480
if (!bundle->_handleCookie) {

CoreFoundation/PlugIn.subproj/CFBundle_Main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ static CFBundleRef _CFBundleGetMainBundleAlreadyLocked(void) {
107107
// get cookie for already-loaded main bundle
108108
#if defined(BINARY_SUPPORT_DLFCN)
109109
if (!_mainBundle->_handleCookie) {
110+
#if !defined(__OpenBSD__)
110111
_mainBundle->_handleCookie = dlopen(NULL, RTLD_NOLOAD | RTLD_FIRST);
112+
#else
113+
_mainBundle->_handleCookie = dlopen(NULL, RTLD_FIRST);
114+
#endif
111115
#if LOG_BUNDLE_LOAD
112116
printf("main bundle %p getting handle %p\n", _mainBundle, _mainBundle->_handleCookie);
113117
#endif /* LOG_BUNDLE_LOAD */

0 commit comments

Comments
 (0)