Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
unix: assume that dlopen() clobbers dlerror()
Browse files Browse the repository at this point in the history
Or rather, don't assume that dlopen() does *not* clobber dlerror().

Joe Ferner reports that loading libjava on OS X sets dlerror() even when
dlopen() succeeds, which makes uv_dlopen() raise an error when it shouldn't.

I haven't been able to reproduce it but it's possible that libjava clobbers
dlerror() by trying (and failing) to load other libraries.

At any rate, Joe confirmed that this patch addresses the issue.

Fixes #462.
  • Loading branch information
bnoordhuis committed Jun 27, 2012
1 parent 4d42af2 commit 1b68434
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/unix/dl.c
Expand Up @@ -34,7 +34,7 @@ int uv_dlopen(const char* filename, uv_lib_t* lib) {
dlerror(); /* Reset error status. */
lib->errmsg = NULL;
lib->handle = dlopen(filename, RTLD_LAZY);
return uv__dlerror(lib);
return lib->handle ? 0 : uv__dlerror(lib);
}


Expand Down

0 comments on commit 1b68434

Please sign in to comment.