aboutsummaryrefslogtreecommitdiffstats
path: root/community/chromium/secure_getenv.patch
blob: 9ab048b6262d743a68f63584069309c79447f90e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--- ./third_party/angle/third_party/vulkan-loader/src/loader/loader.c.orig
+++ ./third_party/angle/third_party/vulkan-loader/src/loader/loader.c
@@ -35,6 +35,9 @@
 #include <stdbool.h>
 #include <string.h>
 #include <stddef.h>
+#if defined(HAVE_GETAUXVAL)
+#include <sys/auxv.h>
+#endif
 
 #if defined(__APPLE__)
 #include <CoreFoundation/CoreFoundation.h>
@@ -256,6 +259,8 @@
 #elif defined(HAVE___SECURE_GETENV)
     (void)inst;
     return __secure_getenv(name);
+#elif defined(HAVE_GETAUXVAL)
+    return getauxval(AT_SECURE) ? NULL : getenv(name);
 #else
 #pragma message(                                                                       \
     "Warning:  Falling back to non-secure getenv for environmental lookups!  Consider" \
--- ./third_party/angle/third_party/vulkan-loader/BUILD.gn.orig
+++ ./third_party/angle/third_party/vulkan-loader/BUILD.gn
@@ -264,8 +264,7 @@
     cflags = [ "/wd4201" ]
   }
   if (is_linux) {
-    # assume secure_getenv() is available
-    defines += [ "HAVE_SECURE_GETENV" ]
+    defines += [ "HAVE_GETAUXVAL" ]
   }
 }