From 3a08670281daa82c75a96a6076f00d42280cb309 Mon Sep 17 00:00:00 2001
From: AnErrupTion <anerruption@disroot.org>
Date: Fri, 7 Jul 2023 18:31:59 +0200
Subject: [PATCH] Add musl fix

---
 Source/Core/Common/Network.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Source/Core/Common/Network.cpp b/Source/Core/Common/Network.cpp
index a5e56b74d2..3e1d47b279 100644
--- a/Source/Core/Common/Network.cpp
+++ b/Source/Core/Common/Network.cpp
@@ -18,6 +18,13 @@
 
 #include <fmt/format.h>
 
+#define _GNU_SOURCE
+#include <features.h>
+#ifndef __USE_GNU
+    #define __MUSL__ 
+#endif
+#undef _GNU_SOURCE
+
 #include "Common/BitUtils.h"
 #include "Common/Random.h"
 #include "Common/StringUtil.h"
@@ -563,7 +570,7 @@ const char* DecodeNetworkError(s32 error_code)
                  sizeof(buffer), nullptr);
   return buffer;
 #elif defined(IS_BSD_STRERROR) ||                                                                  \
-    ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE)
+    ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE) || defined(__MUSL__)
   strerror_r(error_code, buffer, sizeof(buffer));
   return buffer;
 #else
-- 
2.41.0

