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

Commit

Permalink
unix: change uv_dl*() error code
Browse files Browse the repository at this point in the history
Return UV_ENOENT instead of UV_EINVAL. UV_EINVAL was arbitrarily chosen and
turns out to be inconsistent with the Windows implementation.

Fixes #395.
  • Loading branch information
bnoordhuis committed May 3, 2012
1 parent acd0afb commit 93d16e6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/unix/dl.c
Expand Up @@ -31,13 +31,13 @@
* 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 };
static const uv_err_t uv_err_ = { UV_ENOENT, ENOENT };


uv_err_t uv_dlopen(const char* filename, uv_lib_t* library) {
void* handle = dlopen(filename, RTLD_LAZY);
if (handle == NULL) {
return uv_inval_;
return uv_err_;
}

*library = handle;
Expand All @@ -47,7 +47,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_inval_;
return uv_err_;
}

return uv_ok_;
Expand All @@ -63,7 +63,7 @@ uv_err_t uv_dlsym(uv_lib_t library, const char* name, void** ptr) {
address = dlsym(library, name);

if (dlerror()) {
return uv_inval_;
return uv_err_;
}

*ptr = (void*) address;
Expand Down

0 comments on commit 93d16e6

Please sign in to comment.