From b120d00c9f0987aeb2c29b42d1eb76b894d301ea Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 3 Aug 2023 16:39:17 -0700 Subject: [PATCH 1/2] Fix glibc 2.38 compile glibc 2.38 added strlcpy and strlcat. --- 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 f6c236e20..dd5fb0f8d 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -122,6 +122,11 @@ 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 +#endif + #ifndef HAVE_DOSSTR_FUNCS int strupr(char *n); // from dosstr.c int strlwr(char *n); // from dosstr.c @@ -129,7 +134,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 dd3080a97..cbc8ea582 100644 --- a/src/string.c +++ b/src/string.c @@ -15,7 +15,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. From 93f11508fc5298f04fb9b3f53aa8a2e3385cd94b Mon Sep 17 00:00:00 2001 From: bitten2up Date: Sat, 19 Aug 2023 19:52:10 -0500 Subject: [PATCH 2/2] remove stray else --- src/sdl/i_video.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index d2fbb9006..4cac59ced 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1593,7 +1593,6 @@ boolean VID_CheckRenderer(void) else if (vid.glstate == VID_GL_LIBRARY_ERROR) rendererchanged = false; } - else #endif if (!contextcreated)