Discussion:
[Ipmitool-devel] [PATCH 1/2] Avoid wchar_t redefinition
Jörg Krause
2016-04-02 17:58:06 UTC
Permalink
The musl C library does not define _WCHAR_T. Check also for compiler defined
__WCHAR_TYPE__.

Signed-off-by: Jörg Krause <***@embedded.rocks>
---
src/plugins/imb/imbapi.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/plugins/imb/imbapi.h b/src/plugins/imb/imbapi.h
index 74975c6..fa1e9c6 100644
--- a/src/plugins/imb/imbapi.h
+++ b/src/plugins/imb/imbapi.h
@@ -46,7 +46,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endif
#ifndef WIN32
/* WIN32 defines this in stdio.h */
-#ifndef _WCHAR_T
+#if !defined(_WCHAR_T) && !defined(__WCHAR_TYPE__)
#define _WCHAR_T
typedef long wchar_t;
#endif
--
2.8.0
Jörg Krause
2016-04-02 17:58:07 UTC
Permalink
Fixes the following build failure under musl:

imbapi.c: In function 'MapPhysicalMemory':
imbapi.c:109:19: error: 'EXEC_PAGESIZE' undeclared (first use in this function)
# define PAGESIZE EXEC_PAGESIZE

Signed-off-by: Jörg Krause <***@embedded.rocks>
---
src/plugins/imb/imbapi.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/src/plugins/imb/imbapi.c b/src/plugins/imb/imbapi.c
index a9f26e0..26b6c9e 100644
--- a/src/plugins/imb/imbapi.c
+++ b/src/plugins/imb/imbapi.c
@@ -95,6 +95,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
+#ifdef __linux__
+#include <linux/param.h>
+#endif
#endif
#include "imbapi.h"
#include <asm/socket.h>
--
2.8.0
Loading...