From 93d16e6a841972b343af051e3a78e2d164bcfa72 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sun, 29 Apr 2012 21:35:31 +0200 Subject: [PATCH] unix: change uv_dl*() error code Return UV_ENOENT instead of UV_EINVAL. UV_EINVAL was arbitrarily chosen and turns out to be inconsistent with the Windows implementation. Fixes #395. --- src/unix/dl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unix/dl.c b/src/unix/dl.c index 88c9525f..6187f045 100644 --- a/src/unix/dl.c +++ b/src/unix/dl.c @@ -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; @@ -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_; @@ -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;