In case the libc was not found and RTLD_NEXT is used instead, we should not
dlclose it, otherwise mayhem happens.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15228
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
SAFE_FREE(sockets);
- if (swrap.libc.handle != NULL) {
+ if (swrap.libc.handle != NULL
+#ifdef RTLD_NEXT
+ && swrap.libc.handle != RTLD_NEXT
+#endif
+ ) {
dlclose(swrap.libc.handle);
}
- if (swrap.libc.socket_handle) {
+ if (swrap.libc.socket_handle
+#ifdef RTLD_NEXT
+ && swrap.libc.socket_handle != RTLD_NEXT
+#endif
+ ) {
dlclose(swrap.libc.socket_handle);
}
}