package/freeswitch: fix musl build

Fixes:
https://autobuild.buildroot.net/results/b14/b14481674ef0e292c7caf5c7db462bbbb997fc34/

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
Signed-off-by: Arnout Vandecappelle <arnout@rnout.be>
This commit is contained in:
Bernd Kuhls
2026-05-29 15:27:44 +02:00
committed by Arnout Vandecappelle
parent 7a5817137b
commit 06377680ae

View File

@@ -0,0 +1,65 @@
From 81bbf05838fc24b221debfdf75ab8a4c7e7b260c Mon Sep 17 00:00:00 2001
From: Bernd Kuhls <bernd@kuhls.net>
Date: Fri, 29 May 2026 08:14:32 +0200
Subject: [PATCH] apr: fix musl build
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
strerror_r on musl always returns an int since its addition back in 2011
with
https://git.musl-libc.org/cgit/musl/commit/src/string/strerror_r.c?id=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01
Add defines created by freeswitch configure to apr subproject to fix the
build error:
misc/unix/errorcodes.c: In function native_strerror:
misc/unix/errorcodes.c:358:9: error: assignment to const char * from
int makes pointer from integer without a cast [-Wint-conversion]
358 | msg = strerror_r(statcode, buf, bufsize);
Upstream: https://github.com/signalwire/freeswitch/pull/3046
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
libs/apr/misc/unix/errorcodes.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/libs/apr/misc/unix/errorcodes.c b/libs/apr/misc/unix/errorcodes.c
index 3be0b25b93..93c428df62 100644
--- a/libs/apr/misc/unix/errorcodes.c
+++ b/libs/apr/misc/unix/errorcodes.c
@@ -25,6 +25,9 @@
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#endif
+#ifndef WIN32
+#include "../../../src/include/switch_private.h"
+#endif
/*
* stuffbuffer - like fspr_cpystrn() but returns the address of the
@@ -352,12 +355,20 @@ const char *strerror_r(fspr_status_t, char *, fspr_size_t);
static char *native_strerror(fspr_status_t statcode, char *buf,
fspr_size_t bufsize)
{
+#if defined(STRERROR_R_CHAR_P)
const char *msg;
+#else
+ int msg;
+#endif
buf[0] = '\0';
msg = strerror_r(statcode, buf, bufsize);
if (buf[0] == '\0') { /* libc didn't use our buffer */
+#if defined(STRERROR_R_CHAR_P)
return stuffbuffer(buf, bufsize, msg);
+#else
+ return stuffbuffer(buf, bufsize, (const char*)msg);
+#endif
}
else {
return buf;
--
2.47.3