pulseaudio: fix dependencies for openssl-3
[oi-userland.git] / components / x11 / mesa / patches / patch-src_util_u__process.c.patch
blob0c088bcb3881fda0f92e51e00fa79bdd58ac3fd6
1 $NetBSD: patch-src_util_u__process.c,v 1.1 2022/03/13 15:52:50 tnn Exp $
3 atexit() is not a good idea in shared libraries.
5 --- src/util/u_process.c.orig 2021-07-14 20:04:59.260044300 +0000
6 +++ src/util/u_process.c
7 @@ -48,9 +48,15 @@
9 static char *path = NULL;
11 -static void __freeProgramPath()
12 +#if defined(HAVE_NOATEXIT)
13 +static void __attribute__((__destructor__))
14 +#else
15 +static void
16 +#endif
17 +__freeProgramPath()
19 - free(path);
20 + if (path)
21 + free(path);
22 path = NULL;
25 @@ -68,7 +74,9 @@ __getProgramName()
27 if (!path) {
28 path = realpath("/proc/self/exe", NULL);
29 +#if !defined(HAVE_NOATEXIT)
30 atexit(__freeProgramPath);
31 +#endif
34 if (path && strncmp(path, program_invocation_name, strlen(path)) == 0) {