pwrap: Avoid dclose(RTLD_NEXT) In case the libc was not found and RTLD_NEXT is used instead, we should not dlclose it, otherwise mayhem happens. Signed-off-by: Samuel Thibault diff --git a/src/priv_wrapper.c b/src/priv_wrapper.c index acff955..2ca38a0 100644 --- a/src/priv_wrapper.c +++ b/src/priv_wrapper.c @@ -727,7 +727,11 @@ void privwrap_constructor(void) void privwrap_destructor(void) { - if (privwrap.libc.handle != NULL) { + if (privwrap.libc.handle != NULL +#ifdef RTLD_NEXT + && privwrap.libc.handle != RTLD_NEXT +#endif + ) { dlclose(privwrap.libc.handle); } }