From 84f53b9b697f87507b00da92e64f93be76ebe3c0 Mon Sep 17 00:00:00 2001 From: alufolie91 Date: Fri, 4 Aug 2023 23:43:13 +0200 Subject: [PATCH] no idea how tf i git works smh from Kart-Public/master "Fix glibc 2.38 compile" glibc 2.38 added strlcpy and strlcat. https://git.do.srb2.org/KartKrew/Kart-Public/-/commit/c499a8387e1daf9519d443251444beafbdeacea2 smth smth apple ass --- src/doomtype.h | 7 ++++++- src/string.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/doomtype.h b/src/doomtype.h index 4660e876d..f4f32edc8 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -164,6 +164,11 @@ char *strcasestr(const char *in, const char *what); #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 +#endif + #ifndef HAVE_DOSSTR_FUNCS int strupr(char *n); // from dosstr.c int strlwr(char *n); // from dosstr.c @@ -171,7 +176,7 @@ int strlwr(char *n); // from dosstr.c #include // for size_t -#ifndef __APPLE__ +#ifndef 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 c415e5245..34c5e71aa 100644 --- a/src/string.c +++ b/src/string.c @@ -16,7 +16,7 @@ #include #include "doomdef.h" -#if !defined (__APPLE__) +#ifndef HAVE_STRLCPY // Like the OpenBSD version, but it doesn't check for src not being a valid // C string.