From 12c5021396128ca685fa96e5c1d3a42fecef0ff4 Mon Sep 17 00:00:00 2001 From: Georgy Taba <237816847+barab00lka@users.noreply.github.com> Date: Mon, 9 Nov 2026 22:47:14 +0000 Subject: [PATCH 1/2] Update error.c This change makes checking for availability of strerror_r more portable (take musl libc into account for example). If you have GNU_SOURCE defined that does not always mean that you are using glibc therefore strerror_r may be the POSIX variant not GNU. Should not break MacOS compatibility either --- lib/libpe/error.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/libpe/error.c b/lib/libpe/error.c index 3caf1bb..46ea2f1 100644 --- a/lib/libpe/error.c +++ b/lib/libpe/error.c @@ -118,12 +118,9 @@ void pe_error_print(FILE *stream, pe_err_e error) { // Since we define _GNU_SOURCE in our Makefile, strerror_r should be GNU-compliant. // However, looks like if you're on macOS, strerror_r is XSI-compliant. -#if defined(__DARWIN_C_LEVEL) // XSI-compliant - /* int ret = */ strerror_r(errno, errmsg, sizeof errmsg); - const char *errmsg_ptr = errmsg; -#elif defined(_GNU_SOURCE) // GNU-specific +#if defined(__GLIBC__) && defined(_GNU_SOURCE) // we have GNU strerror_r const char *errmsg_ptr = strerror_r(errno, errmsg, sizeof errmsg); -#else // Fallback to XSI-compliant +#else // we don't have it /* int ret = */ strerror_r(errno, errmsg, sizeof errmsg); const char *errmsg_ptr = errmsg; #endif From b08173ff26edcd33332a061e52fe4f0bb77d9b5b Mon Sep 17 00:00:00 2001 From: Georgy Taba <237816847+barab00lka@users.noreply.github.com> Date: Mon, 9 Nov 2026 22:50:28 +0000 Subject: [PATCH 2/2] Update queue.h This removes the unneeded internal header as musl does not provide it (its an internal glibc header that serves close to no purpose and may be left out) see: https://wiki.musl-libc.org/faq.html#Q:-When-compiling-something-against-musl,-I-get-error-messages-about-%3Ccode%3Esys/cdefs.h%3C/code%3E --- include/compat/sys/queue.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/compat/sys/queue.h b/include/compat/sys/queue.h index 946c9be..a99db26 100644 --- a/include/compat/sys/queue.h +++ b/include/compat/sys/queue.h @@ -34,7 +34,6 @@ #ifndef _SYS_QUEUE_H_ #define _SYS_QUEUE_H_ -#include /* * This file defines four types of data structures: singly-linked lists,