diff --git a/src/doomtype.h b/src/doomtype.h index 58565a2326d614634820de6bae3d114feac83ab9..4070e346a1b13dd516a91504f056cebc4defb20d 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -113,9 +113,13 @@ int endswith (const char *base, const char *tag); #define HAVE_DOSSTR_FUNCS #endif -// glibc 2.38: added strlcpy and strlcat to _DEFAULT_SOURCE -#if defined (__APPLE__) || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) -#define HAVE_STRLCPY +#if defined (__APPLE__) + #define SRB2_HAVE_STRLCPY +#elif defined (__GLIBC_PREREQ) + // glibc 2.38: added strlcpy and strlcat to _DEFAULT_SOURCE + #if __GLIBC_PREREQ(2, 38) + #define SRB2_HAVE_STRLCPY + #endif #endif #ifndef HAVE_DOSSTR_FUNCS @@ -125,7 +129,7 @@ int strlwr(char *n); // from dosstr.c #include <stddef.h> // for size_t -#ifndef HAVE_STRLCPY +#ifndef SRB2_HAVE_STRLCPY size_t strlcat(char *dst, const char *src, size_t siz); size_t strlcpy(char *dst, const char *src, size_t siz); #endif diff --git a/src/string.c b/src/string.c index cbc8ea5826f81bb1bd8a54a15d9684123ed890f4..2f16fa4c68a35fa287156f546fc2973e9d4ad426 100644 --- a/src/string.c +++ b/src/string.c @@ -15,7 +15,7 @@ #include <string.h> #include "doomdef.h" -#ifndef HAVE_STRLCPY +#ifndef SRB2_HAVE_STRLCPY // Like the OpenBSD version, but it doesn't check for src not being a valid // C string.