diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2012-01-03 15:15:54 +0100 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2012-01-06 00:00:40 +0100 |
commit | 075acfa2d6c823ec9ccedba5fdbca172752d1e4a (patch) | |
tree | 17d87f0c2a26dae8247b45959b281cdcf4103f46 /deps/uv/src/unix/dl.c | |
parent | aa67b1f3750646a0f30e12a3b4e4fcb84dc8cafa (diff) | |
download | android-node-v8-075acfa2d6c823ec9ccedba5fdbca172752d1e4a.tar.gz android-node-v8-075acfa2d6c823ec9ccedba5fdbca172752d1e4a.tar.bz2 android-node-v8-075acfa2d6c823ec9ccedba5fdbca172752d1e4a.zip |
uv: upgrade to 56a31f0
Diffstat (limited to 'deps/uv/src/unix/dl.c')
-rw-r--r-- | deps/uv/src/unix/dl.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/deps/uv/src/unix/dl.c b/deps/uv/src/unix/dl.c index 6c4ddff89e..41c244d79e 100644 --- a/deps/uv/src/unix/dl.c +++ b/deps/uv/src/unix/dl.c @@ -25,11 +25,17 @@ #include <dlfcn.h> #include <errno.h> +/* The dl family of functions don't set errno. We need a good way to communicate + * errors to the caller but there is only dlerror() and that returns a string - + * a string that may or may not be safe to keep a reference to... + */ +static const uv_err_t uv_inval_ = { UV_EINVAL, EINVAL }; + uv_err_t uv_dlopen(const char* filename, uv_lib_t* library) { void* handle = dlopen(filename, RTLD_LAZY); if (handle == NULL) { - return uv__new_sys_error(errno); + return uv_inval_; } *library = handle; @@ -39,7 +45,7 @@ uv_err_t uv_dlopen(const char* filename, uv_lib_t* library) { uv_err_t uv_dlclose(uv_lib_t library) { if (dlclose(library) != 0) { - return uv__new_sys_error(errno); + return uv_inval_; } return uv_ok_; @@ -47,9 +53,15 @@ uv_err_t uv_dlclose(uv_lib_t library) { uv_err_t uv_dlsym(uv_lib_t library, const char* name, void** ptr) { - void* address = dlsym(library, name); - if (address == NULL) { - return uv__new_sys_error(errno); + void* address; + + /* Reset error status. */ + dlerror(); + + address = dlsym(library, name); + + if (dlerror()) { + return uv_inval_; } *ptr = (void*) address; |