From 63411321753e1ee959fd1e69ba5986d2438f1b39 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Sun, 23 Dec 2018 06:44:50 +0000 Subject: [PATCH] roken: fix build breakage, AT_HWCAP2 may be undefined (#446) --- lib/roken/test-auxval.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/roken/test-auxval.c b/lib/roken/test-auxval.c index 7e19ee530..6dbd3e7cc 100644 --- a/lib/roken/test-auxval.c +++ b/lib/roken/test-auxval.c @@ -120,6 +120,22 @@ getprocauxval(unsigned long type) return e->a_un.a_val; } +/* returns 1 if auxval type is handled specially by libc */ +static int +is_special_auxv_p(long type) +{ +#ifdef AT_HWCAP + if (type == AT_HWCAP) + return 1; +#endif +#ifdef AT_HWCAP2 + if (type == AT_HWCAP) + return 1; +#endif + + return 0; +} + int main(int argc, char **argv, char **env) { @@ -166,8 +182,8 @@ main(int argc, char **argv, char **env) if (a[1] != 0) warnx("AT_NULL with non-zero value %lu?!", a[1]); continue; - } else if (a[0] == AT_HWCAP || a[0] == AT_HWCAP2) - continue; /* these are handled specially by libc */ + } else if (is_special_auxv_p(a[0])) + continue; errno = EACCES;