Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Nov 2018 00:51:58 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 115631] [libc] [patch] [request] make dlclose(3) atexit-aware
Message-ID:  <bug-115631-227-o6xNMZ4b4q@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-115631-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-115631-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D115631

--- Comment #8 from Bryan Drewery <bdrewery@FreeBSD.org> ---
*Very naive and untested*.
It seems like we need something like this:

diff --git lib/libc/stdlib/atexit.c lib/libc/stdlib/atexit.c
index bc9ad3ebd7bf..8df6cd4e31b0 100644
--- lib/libc/stdlib/atexit.c
+++ lib/libc/stdlib/atexit.c
@@ -125,6 +125,8 @@ atexit_register(struct atexit_fn *fptr)
        return 0;
 }

+extern void *__dso_handle __hidden;
+
 /*
  * Register a function to be performed at exit.
  */
@@ -137,7 +139,7 @@ atexit(void (*func)(void))
        fn.fn_type =3D ATEXIT_FN_STD;
        fn.fn_ptr.std_func =3D func;
        fn.fn_arg =3D NULL;
-       fn.fn_dso =3D NULL;
+       fn.fn_dso =3D __dso_handle;

        error =3D atexit_register(&fn);
        return (error);

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-115631-227-o6xNMZ4b4q>