From 3fc80e1801019f0aad4ce6d37db7df956ec33e82 Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@cloudius-systems.com>
Date: Mon, 18 Mar 2013 16:09:39 +0100
Subject: [PATCH] hack around glibc header mess for strerror_r

---
 libc/string/strerror_r.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/libc/string/strerror_r.c b/libc/string/strerror_r.c
index 907dcf079..06058472a 100644
--- a/libc/string/strerror_r.c
+++ b/libc/string/strerror_r.c
@@ -1,6 +1,17 @@
-#include <string.h>
+
+#include <sys/types.h>
 #include <errno.h>
 
+/*
+ * Glibc provides two incompatible versions of strerror_r and uses
+ * redirection magic for the XPG compliants ones in <string.h>,
+ * so we must avoid including that header as long as we use the glibc
+ * headers instead of the musl ones.
+ */
+extern char *strerror (int);
+extern size_t strlen (const char *);
+extern void *memcpy (void *__restrict, const void *__restrict, size_t);
+
 int strerror_r(int err, char *buf, size_t buflen)
 {
 	char *msg = strerror(err);
-- 
GitLab