diff options
Diffstat (limited to 'dlfcn/dlerror.c')
-rw-r--r-- | dlfcn/dlerror.c | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/dlfcn/dlerror.c b/dlfcn/dlerror.c index 7db70a2..3df8602 100644 --- a/dlfcn/dlerror.c +++ b/dlfcn/dlerror.c @@ -28,16 +28,6 @@ #include <assert.h> #include <dlerror.h> -#if !defined SHARED && IS_IN (libdl) - -char * -dlerror (void) -{ - return __dlerror (); -} - -#else - char * __dlerror (void) { @@ -86,11 +76,15 @@ __dlerror (void) result->objname[0] == '\0' ? "" : ": ", _(result->errstring)); else - n = __asprintf (&buf, "%s%s%s: %s", - result->objname, - result->objname[0] == '\0' ? "" : ": ", - _(result->errstring), - strerror (result->errcode)); + { + __set_errno (result->errcode); + n = __asprintf (&buf, "%s%s%s: %m", + result->objname, + result->objname[0] == '\0' ? "" : ": ", + _(result->errstring)); + /* Set errno again in case asprintf clobbered it. */ + __set_errno (result->errcode); + } /* Mark the error as delivered. */ result->returned = true; @@ -108,9 +102,11 @@ __dlerror (void) existing string as a fallback. */ return result->errstring; } -# ifdef SHARED -strong_alias (__dlerror, dlerror) -# endif +versioned_symbol (libc, __dlerror, dlerror, GLIBC_2_34); + +#if OTHER_SHLIB_COMPAT (libdl, GLIBC_2_0, GLIBC_2_34) +compat_symbol (libdl, __dlerror, dlerror, GLIBC_2_0); +#endif int _dlerror_run (void (*operate) (void *), void *args) @@ -200,13 +196,13 @@ _dlerror_run (void (*operate) (void *), void *args) return 1; } } +libc_hidden_def (_dlerror_run) -# ifdef SHARED - +#ifdef SHARED struct dlfcn_hook *_dlfcn_hook __attribute__((nocommon)); -libdl_hidden_data_def (_dlfcn_hook) +libc_hidden_data_def (_dlfcn_hook) -# else +#else /* !SHARED */ static struct dlfcn_hook _dlfcn_hooks = { @@ -230,5 +226,4 @@ __libc_register_dlfcn_hook (struct link_map *map) if (hook != NULL) *hook = &_dlfcn_hooks; } -# endif -#endif +#endif /* !SHARED */ |