From 07bdfeedb8a381ac4caaee9aa9e4d9bbb1070e46 Mon Sep 17 00:00:00 2001 From: Larkin Nickle Date: Thu, 21 Oct 2021 19:15:15 -0400 Subject: [PATCH] Define MAP_FAILED where relevant if undefined On systems such as HP-UX 10.20, MAP_FAILED is not defined. --- lib/util/getentropy.c | 4 ++++ lib/util/regress/mktemp/mktemp_test.c | 4 ++++ lib/util/snprintf.c | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/lib/util/getentropy.c b/lib/util/getentropy.c index 4b1795f96..98df88937 100644 --- a/lib/util/getentropy.c +++ b/lib/util/getentropy.c @@ -76,6 +76,10 @@ # define MAP_ANON MAP_ANONYMOUS #endif +#ifndef MAP_FAILED +# define MAP_FAILED ((void *) -1) +#endif + #define REPEAT 5 #define min(a, b) (((a) < (b)) ? (a) : (b)) diff --git a/lib/util/regress/mktemp/mktemp_test.c b/lib/util/regress/mktemp/mktemp_test.c index cd5aa9755..73a5b2919 100644 --- a/lib/util/regress/mktemp/mktemp_test.c +++ b/lib/util/regress/mktemp/mktemp_test.c @@ -31,6 +31,10 @@ # endif #endif +#ifndef MAP_FAILED +# define MAP_FAILED ((void *) -1) +#endif + #define MAX_TEMPLATE_LEN 10 #define MAX_TRIES 100 #define MIN_Xs 6 diff --git a/lib/util/snprintf.c b/lib/util/snprintf.c index 6d027ad72..76278630c 100644 --- a/lib/util/snprintf.c +++ b/lib/util/snprintf.c @@ -116,6 +116,10 @@ static int xxxprintf(char **, size_t, int, const char *, va_list); # define MAP_ANON MAP_ANONYMOUS #endif +#ifndef MAP_FAILED +# define MAP_FAILED ((void *) -1) +#endif + /* * Allocate "size" bytes via mmap. */