aboutsummaryrefslogtreecommitdiff
blob: ae9442fc09b6bde66328bd8e8ab56b506c14d7da (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
From 347c5bb22f8f79f339e578e30a19fed15e7f3e09 Mon Sep 17 00:00:00 2001
From: Jory Pratt <anarchy@gentoo.org>
Date: Thu, 4 Apr 2019 18:59:18 -0500
Subject: [PATCH] fix musl libc compile

---
 src/test/test-hexdecoct.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/test/test-hexdecoct.c b/src/test/test-hexdecoct.c
index 101a78b..dc4e09b 100644
--- a/src/test/test-hexdecoct.c
+++ b/src/test/test-hexdecoct.c
@@ -10,6 +10,16 @@
 /// Additional includes needed by elogind
 #include "musl_missing.h"
 
+#define strndupa(s, n) \
+	({ \
+	  const char *__in = (s);			\
+	  size_t __len = strnlen(__in, (n));		\
+	  char *__out = (char *)alloca(__len + 1);	\
+	  __out[__len] = '\0';				\
+	  (char *)memcpy(__out, __in, __len);		\
+	})
+
+
 static void test_hexchar(void) {
         assert_se(hexchar(0xa) == 'a');
         assert_se(hexchar(0x0) == '0');
-- 
2.21.0