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); }