[glib/wip/lantw/check-getauxval-for-freebsd-12] gutils: Check whether getauxval function exists
- From: Ting-Wei Lan <lantw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/lantw/check-getauxval-for-freebsd-12] gutils: Check whether getauxval function exists
- Date: Sun, 28 Oct 2018 03:14:01 +0000 (UTC)
commit d216f1d0bb128b22c702df23bee77d97e2b6dfdd
Author: Ting-Wei Lan <lantw src gnome org>
Date: Sun Oct 28 01:37:39 2018 +0800
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
configure.ac | 1 +
glib/gutils.c | 2 +-
meson.build | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/configure.ac b/configure.ac
index b69b27ca5..743840d1b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -862,6 +862,7 @@ AC_CHECK_FUNCS(getmntent_r setmntent endmntent hasmntopt getfsstat getvfsstat fa
case $host_os in aix*) ac_cv_func_splice=no ;; esac # AIX splice() is something else
AC_CHECK_FUNCS(splice)
AC_CHECK_FUNCS(prlimit)
+AC_CHECK_FUNCS(getauxval)
# To avoid finding a compatibility unusable statfs, which typically
# successfully compiles, but warns to use the newer statvfs interface:
diff --git a/glib/gutils.c b/glib/gutils.c
index 2b750aba9..e86aeca32 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -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;
diff --git a/meson.build b/meson.build
index f2ffd9919..e642ae227 100644
--- a/meson.build
+++ b/meson.build
@@ -397,6 +397,7 @@ functions = [
'fchown',
'fdwalk',
'fsync',
+ 'getauxval',
'getc_unlocked',
'getfsstat',
'getgrgid_r',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]