gutils: Check whether getauxval function exists

FreeBSD 12 adds a new header, sys/auxv.h, to declare a function, elf_aux_info,
for public use, which was considered an internal function in previous releases.
This new function provides similar functionality with glibc getauxval, which is
also declared in the same header, but their interfaces are not compatible. Since
the only usage of sys/auxv.h is in g_check_setuid and FreeBSD already has
issetugid to provide the required functionality, we fixes the compilation error
by adding a check for getauxval function to prevent g_check_setuid from calling
getauxval when sys/auxv.h is found but getauxval is not available.

https://reviews.freebsd.org/D12743
https://reviews.freebsd.org/rS324815
This commit is contained in:
Ting-Wei Lan
2018-10-28 01:37:39 +08:00
committed by Philip Withnall
parent 6e77089337
commit 295964a380
3 changed files with 3 additions and 1 deletions

View File

@@ -2503,7 +2503,7 @@ const gchar *g_get_tmp_dir_utf8 (void) { return g_get_tmp_dir (); }
gboolean
g_check_setuid (void)
{
#if defined(HAVE_SYS_AUXV_H)
#if defined(HAVE_SYS_AUXV_H) && defined(HAVE_GETAUXVAL) && defined(AT_SECURE)
unsigned long value;
int errsv;