summaryrefslogtreecommitdiff
path: root/deps
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2011-12-18 22:28:30 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2011-12-18 22:35:08 +0100
commitf322bbe729febeccec34ef0146831be1a1d29533 (patch)
tree4b00ec09cfa39cd4fe6973c926479d3a535c58ff /deps
parentec51bfc99574c7b42072bcb8d62dfe3165a6a034 (diff)
downloadnode-new-f322bbe729febeccec34ef0146831be1a1d29533.tar.gz
uv: upgrade to feb267e
Diffstat (limited to 'deps')
-rw-r--r--deps/uv/include/uv.h3
-rw-r--r--deps/uv/src/unix/dl.c22
2 files changed, 19 insertions, 6 deletions
diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h
index e8b70b180d..a200708755 100644
--- a/deps/uv/include/uv.h
+++ b/deps/uv/include/uv.h
@@ -1250,7 +1250,8 @@ UV_EXTERN uv_err_t uv_dlopen(const char* filename, uv_lib_t* library);
UV_EXTERN uv_err_t uv_dlclose(uv_lib_t library);
/*
- * Retrieves a data pointer from a dynamic library.
+ * Retrieves a data pointer from a dynamic library. It is legal for a symbol to
+ * map to NULL.
*/
UV_EXTERN uv_err_t uv_dlsym(uv_lib_t library, const char* name, void** ptr);
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;