From 14304eb31eea134db58870a6d87312231b1e02b6 Mon Sep 17 00:00:00 2001 From: Adeel Mujahid <3840695+am11@users.noreply.github.com> Date: Sat, 19 Mar 2022 15:14:13 +0200 Subject: [PATCH] Include sys/auxv.h in getexepath (#66874) --- src/native/minipal/getexepath.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/native/minipal/getexepath.h b/src/native/minipal/getexepath.h index ecc6dc8d72771..0db1b73aa6f01 100644 --- a/src/native/minipal/getexepath.h +++ b/src/native/minipal/getexepath.h @@ -17,6 +17,8 @@ #include #elif defined(_WIN32) #include +#elif HAVE_GETAUXVAL +#include #endif #ifdef __cplusplus @@ -74,8 +76,8 @@ static inline char* minipal_getexepath(void) return strdup("/managed"); #else #if HAVE_GETAUXVAL && defined(AT_EXECFN) - const char* path = (const char *)getauxval(AT_EXECFN); - if (path) + const char* path = (const char *)(getauxval(AT_EXECFN)); + if (path && !errno) { return realpath(path, NULL); }