From cbb311d0b14cb4acce86b32756101f73f4826f7c Mon Sep 17 00:00:00 2001 From: Evan Gates Date: Thu, 21 Apr 2022 15:55:38 -0600 Subject: [PATCH] main: check _POSIX_VERSION for fmemopen --- main.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index afb5dfb..6fe954d 100644 --- a/main.c +++ b/main.c @@ -10,9 +10,14 @@ #include "msd/bootcode4.h" #include "msd/start4.h" -/* Assume BSD without native fmemopen() if doesn't seem to be glibc */ -#if defined(__APPLE__) || (!defined(_GNU_SOURCE) && (!defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200809L)) -#include "fmemopen.c" // BSD fmemopen() compat in terms of funopen() +/* + * Old OS X/BSD do not implement fmemopen(). If the version of POSIX + * supported is old enough that fmemopen() isn't included, assume + * we're on a BSD compatible system and define a fallback fmemopen() + * that depends on funopen(). + */ +#if _POSIX_VERSION <= 200112L +#include "fmemopen.c" #endif int signed_boot = 0; -- libgit2 0.21.4