aboutsummaryrefslogtreecommitdiffstats
path: root/main/conky/musl-fixes.patch
blob: 4891f3278574669177768c45fc9d1bb67d1df37d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
From 21b0a052af22a355321cce13abd573dbcf90dd4a Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 23 Jul 2015 13:57:18 +0200
Subject: [PATCH 2/3] Remove use of sysctl.h

---
 src/common.cc | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/common.cc b/src/common.cc
index 126f30a..116cd06 100644
--- a/src/common.cc
+++ b/src/common.cc
@@ -42,7 +42,6 @@
 #include <errno.h>
 #include <time.h>
 #include <sys/ioctl.h>
-#include <sys/sysctl.h>
 #include <net/if.h>
 #include <netinet/in.h>
 #include <pthread.h>
-- 
2.4.6


From 3d67ed4920d31e5b17dd61684713d061d4fd7598 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 23 Jul 2015 13:58:02 +0200
Subject: [PATCH 3/3] Use portable version of strerror_r

---
 src/c++wrap.cc | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/c++wrap.cc b/src/c++wrap.cc
index c21b473..213f9c4 100644
--- a/src/c++wrap.cc
+++ b/src/c++wrap.cc
@@ -26,8 +26,14 @@
 #include "c++wrap.hh"
 
 #include <unistd.h>
+
+/* force use of  POSIX strerror_r instead of non-portable GNU specific */
+#ifdef _GNU_SOURCE
+#undef _GNU_SOURCE
+#endif
 #include <string.h>
 
+
 #if !defined(HAVE_PIPE2) || !defined(HAVE_O_CLOEXEC)
 #include <fcntl.h>
 
@@ -62,8 +68,10 @@ namespace {
 
 std::string strerror_r(int errnum)
 {
-	char buf[100];
-	return strerror_r(errnum, buf, sizeof buf);
+	static thread_local char buf[100];
+	if (strerror_r(errnum, buf, sizeof buf) != 0)
+		snprintf(buf, sizeof buf, "Unknown error %i", errnum);
+	return buf;
 }
 
 std::pair<int, int> pipe2(int flags)
-- 
2.4.6