OS/2 kLIBC has <sys/mman.h> and mprotect() but not mmap(). As a result,
it's not enough to test with HAVE_SYS_MMAN_H and HAVE_MPROTECT. It's
necessary to test with HAVE_MMAP on OS/2 kLIBC.
* tests/zerosize-ptr.h [OS/2 kLIBC]: Test with HAVE_MMAP, too.
(zerosize_ptr) [OS/2 kLIBC]: Likewise.
---
tests/zerosize-ptr.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/zerosize-ptr.h b/tests/zerosize-ptr.h
index 45a1729d3..b8e3a9e06 100644
--- a/tests/zerosize-ptr.h
+++ b/tests/zerosize-ptr.h
@@ -37,7 +37,7 @@
We don't use HAVE_MMAP, because AC_FUNC_MMAP would not define it on HP-UX.
HAVE_MPROTECT is not enough, because mingw does not have mmap() but has an
mprotect() function in libgcc.a. */
-#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
+#if HAVE_SYS_MMAN_H && HAVE_MPROTECT && (!defined __KLIBC__ || HAVE_MMAP)
# include <fcntl.h>
# include <unistd.h>
# include <sys/types.h>
@@ -58,7 +58,7 @@ zerosize_ptr (void)
{
/* Use mmap and mprotect when they exist. Don't test HAVE_MMAP, because it is
not defined on HP-UX 11 (since it does not support MAP_FIXED). */
-#if HAVE_SYS_MMAN_H && HAVE_MPROTECT
+#if HAVE_SYS_MMAN_H && HAVE_MPROTECT && (!defined __KLIBC__ || HAVE_MMAP)
# if HAVE_MAP_ANONYMOUS
const int flags = MAP_ANONYMOUS | MAP_PRIVATE;
const int fd = -1;
--
2.22.0