aboutsummaryrefslogtreecommitdiffstats
path: root/testing/ndctl/0001-util-Enable-ndctl-to-compile-on-non-glibc-envs.patch
blob: 91def43fe418c573f12fb4e588f0dcad106a5705 (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
From da1d1cbbffe90aefe1579d2708bae43753c5afb4 Mon Sep 17 00:00:00 2001
From: Breno Leitao <breno.leitao@gmail.com>
Date: Sat, 11 Mar 2017 22:33:43 +0000
Subject: [PATCH] util: Enable ndctl to compile on non-glibc envs

Currently ndctl does not build on non-glibc environments, as musl.

It fails because neither functions secure_getenv() nor
_secure_getenv() are available. These functions are only available
on systems with glibc version 2.17 or later.

This patch just make a fallback to getenv() if the secure functions
are missing.

Signed-off-by: Breno Leitao <breno.leitao@gmail.com>
---
 util/log.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/util/log.h b/util/log.h
index 5c5922f..5fc56e8 100644
--- a/util/log.h
+++ b/util/log.h
@@ -62,7 +62,8 @@ do { \
 #  ifdef HAVE___SECURE_GETENV
 #    define secure_getenv __secure_getenv
 #  else
-#    error neither secure_getenv nor __secure_getenv is available
+#    warning neither secure_getenv nor __secure_getenv is available.
+#    define secure_getenv getenv
 #  endif
 #endif
 
-- 
2.11.1